Module jpms_dss_asic_common
Class DefaultContainerMerger
java.lang.Object
eu.europa.esig.dss.asic.common.merge.DefaultContainerMerger
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionprotected ASiCContent[]An array of ASiC contents representing containers to be mergedprotected static final eu.europa.esig.dss.enumerations.DigestAlgorithmDigest algo used for internal documents comparison -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty constructorprotectedDefaultContainerMerger(ASiCContent... asicContents) This constructor is used to create anASiCContainerMergerfrom to givenASiCContentsprotectedDefaultContainerMerger(eu.europa.esig.dss.model.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(eu.europa.esig.dss.model.DSSDocument... containers) This method loads a relevantASiCContainerMergerto be used to merge given container documentsprotected abstract DefaultASiCContainerExtractorgetContainerExtractor(eu.europa.esig.dss.model.DSSDocument container) This method returns a relevant ASiC container extractorGets the merged container result's creation timeprotected StringgetFinalContainerName(eu.europa.esig.dss.enumerations.ASiCContainerType asicContainerType) This method returns a filename for the merged containerprotected abstract eu.europa.esig.dss.enumerations.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(eu.europa.esig.dss.model.DSSDocument container) This method verifies whether the providedcontaineris supported by the current classbooleanisSupported(eu.europa.esig.dss.model.DSSDocument... containers) Returns whether the format of given containers is supported by the currentASiCContainerMergereu.europa.esig.dss.model.DSSDocumentmerge()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
protected static final eu.europa.esig.dss.enumerations.DigestAlgorithm DEFAULT_DIGEST_ALGORITHMDigest 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
protected DefaultContainerMerger(eu.europa.esig.dss.model.DSSDocument... containers) 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
protected abstract DefaultASiCContainerExtractor getContainerExtractor(eu.europa.esig.dss.model.DSSDocument container) This method returns a relevant ASiC container extractor- Parameters:
container-DSSDocumentrepresenting a container to be extracted- Returns:
DefaultASiCContainerExtractor
-
getCreationTime
Gets the merged container result's creation time- Returns:
Date
-
setCreationTime
Sets the creation time of the merged container result (optional)- Parameters:
creationTime-Date
-
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
public boolean isSupported(eu.europa.esig.dss.model.DSSDocument... containers) 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
protected abstract boolean isSupported(eu.europa.esig.dss.model.DSSDocument container) 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
public eu.europa.esig.dss.model.DSSDocument 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
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-ASiCContainerTypeASiC type of the merged container- Returns:
Stringfilename of the container
-