Package eu.europa.esig.dss.asic.cades
Class SimpleASiCWithCAdESFilenameFactory
java.lang.Object
eu.europa.esig.dss.asic.common.AbstractASiCFilenameFactory
eu.europa.esig.dss.asic.cades.DefaultASiCWithCAdESFilenameFactory
eu.europa.esig.dss.asic.cades.SimpleASiCWithCAdESFilenameFactory
- All Implemented Interfaces:
ASiCWithCAdESFilenameFactory
,ASiCEvidenceRecordFilenameFactory
,ASiCFilenameFactory
,Serializable
This class provides a simple way to define custom names for file entries created within an ASiC with CAdES container,
by using set and get methods.
This factory adds "META-INF/" prefix to the filename, when required.
When a target filename for a particular document type is not specified,
then the default processing will take precedence.
NOTE: This factory shall be modified when consequently signing/extending a single container.
WARN: The class does not verify the conformance of the defined filenames to the EN 319 162-1 standard.
- See Also:
-
Constructor Summary
ConstructorDescriptionDefault constructor instantiating factory with null values -
Method Summary
Modifier and TypeMethodDescriptiongetArchiveManifestFilename
(ASiCContent asicContent) Returns a new filename of an archive manifest file to be moved.getDataPackageFilename
(ASiCContent asicContent) Returns a name of a ZIP archive containing signed documents in case of an ASiC-E signature, when applicablegetEvidenceRecordFilename
(ASiCContent asicContent, EvidenceRecordTypeEnum evidenceRecordType) Returns a filename for an evidence record file to be createdgetEvidenceRecordManifestFilename
(ASiCContent asicContent) Returns a filename for an evidence record's ASIC manifest file to be createdgetManifestFilename
(ASiCContent asicContent) Returns a filename of a manifest file to be createdgetSignatureFilename
(ASiCContent asicContent) Returns a filename for a signature file to be createdgetTimestampFilename
(ASiCContent asicContent) Returns a filename for a timestamp file to be createdprotected String
getValidArchiveManifestFilename
(String archiveManifestFilename, ASiCContent asicContent) This method returns a valid archive manifest filename.protected String
getValidEvidenceRecordFilename
(String evidenceRecordFilename, ASiCContent asicContent, EvidenceRecordTypeEnum evidenceRecordType) This method returns a valid evidence record filenameprotected String
getValidManifestFilename
(String manifestFilename, ASiCContent asicContent) This method returns a valid manifest filenameprotected String
getValidSignatureFilename
(String signatureFilename, ASiCContent asicContent) This method returns a valid signature filenameprotected String
getValidTimestampFilename
(String timestampFilename, ASiCContent asicContent) This method returns a valid timestamp filenamevoid
setArchiveManifestFilename
(String archiveManifestFilename) Sets a new filename for the last archive manifest document (when applicable)void
setDataPackageFilename
(String dataPackageFilename) Sets a filename for a new ZIP data package (when applicable)void
setEvidenceRecordFilename
(String evidenceRecordFilename) Sets a filename for a new evidence record document.void
setEvidenceRecordManifestFilename
(String evidenceRecordManifestFilename) Sets a new filename for the ASiC evidence record manifest document (when applicable)void
setManifestFilename
(String manifestFilename) Sets a filename for a new manifest document (when applicable).void
setSignatureFilename
(String signatureFilename) Sets a filename for a new signature document (when applicable).void
setTimestampFilename
(String timestampFilename) Sets a filename for a new timestamp document (when applicable).Methods inherited from class eu.europa.esig.dss.asic.common.AbstractASiCFilenameFactory
assertASiCContentIsValid, assertFilenameValid, getNextAvailableDocumentName, getValidDataPackageFilename, getValidEvidenceRecordManifestFilename, getWithMetaInfFolder, isAvailableName
-
Constructor Details
-
SimpleASiCWithCAdESFilenameFactory
public SimpleASiCWithCAdESFilenameFactory()Default constructor instantiating factory with null values
-
-
Method Details
-
getSignatureFilename
Description copied from interface:ASiCFilenameFactory
Returns a filename for a signature file to be created- Specified by:
getSignatureFilename
in interfaceASiCFilenameFactory
- Overrides:
getSignatureFilename
in classDefaultASiCWithCAdESFilenameFactory
- Parameters:
asicContent
-ASiCContent
representing a content of an ASiC container- Returns:
String
signature filename
-
setSignatureFilename
Sets a filename for a new signature document (when applicable). NOTE: The name of the signature file shall be: - ASiC-S with CAdES : "META-INF/signature.p7s"; - ASiC-E with CAdES : "META-INF/signature*.p7s". "META-INF/" is optional.- Parameters:
signatureFilename
-String
-
getTimestampFilename
Description copied from interface:ASiCWithCAdESFilenameFactory
Returns a filename for a timestamp file to be created- Specified by:
getTimestampFilename
in interfaceASiCWithCAdESFilenameFactory
- Overrides:
getTimestampFilename
in classDefaultASiCWithCAdESFilenameFactory
- Parameters:
asicContent
-ASiCContent
representing a content of an ASiC container- Returns:
String
timestamp filename
-
setTimestampFilename
Sets a filename for a new timestamp document (when applicable). NOTE: The name of the timestamp file shall be: - ASiC-S with CAdES : "META-INF/timestamp.tst"; - ASiC-E with CAdES : "META-INF/timestamp*.tst". "META-INF/" is optional.- Parameters:
timestampFilename
-String
-
getEvidenceRecordFilename
public String getEvidenceRecordFilename(ASiCContent asicContent, EvidenceRecordTypeEnum evidenceRecordType) Description copied from interface:ASiCEvidenceRecordFilenameFactory
Returns a filename for an evidence record file to be created- Specified by:
getEvidenceRecordFilename
in interfaceASiCEvidenceRecordFilenameFactory
- Overrides:
getEvidenceRecordFilename
in classDefaultASiCWithCAdESFilenameFactory
- Parameters:
asicContent
-ASiCContent
representing a content of an ASiC containerevidenceRecordType
-EvidenceRecordTypeEnum
type of the evidence record to get a new filename for- Returns:
String
evidence record filename
-
setEvidenceRecordFilename
Sets a filename for a new evidence record document. NOTE: The name of the evidence record file shall be: - ASiC-S with CAdES : "META-INF/evidencerecord.xml" or "META-INF/evidencerecord.ers" - ASiC-E with CAdES : "META-INF/*evidencerecord*.xml" or "META-INF/*evidencerecord*.ers" "META-INF/" is optional.- Parameters:
evidenceRecordFilename
-String
-
getManifestFilename
Description copied from interface:ASiCFilenameFactory
Returns a filename of a manifest file to be created- Specified by:
getManifestFilename
in interfaceASiCFilenameFactory
- Overrides:
getManifestFilename
in classDefaultASiCWithCAdESFilenameFactory
- Parameters:
asicContent
-ASiCContent
representing a content of an ASiC container- Returns:
String
manifest filename
-
setManifestFilename
-
getArchiveManifestFilename
Description copied from interface:ASiCWithCAdESFilenameFactory
Returns a new filename of an archive manifest file to be moved. NOTE: ASiC-E with CAdES shall always create a new archive manifest with the same name, while moving the last existing archive manifest.- Specified by:
getArchiveManifestFilename
in interfaceASiCWithCAdESFilenameFactory
- Overrides:
getArchiveManifestFilename
in classDefaultASiCWithCAdESFilenameFactory
- Parameters:
asicContent
-ASiCContent
representing a content of an ASiC container- Returns:
String
manifest filename
-
setArchiveManifestFilename
-
getDataPackageFilename
Description copied from interface:ASiCFilenameFactory
Returns a name of a ZIP archive containing signed documents in case of an ASiC-E signature, when applicable- Specified by:
getDataPackageFilename
in interfaceASiCFilenameFactory
- Overrides:
getDataPackageFilename
in classDefaultASiCWithCAdESFilenameFactory
- Parameters:
asicContent
-ASiCContent
representing a content of an ASiC container- Returns:
String
data package filename
-
setDataPackageFilename
-
getEvidenceRecordManifestFilename
Description copied from interface:ASiCEvidenceRecordFilenameFactory
Returns a filename for an evidence record's ASIC manifest file to be created- Specified by:
getEvidenceRecordManifestFilename
in interfaceASiCEvidenceRecordFilenameFactory
- Overrides:
getEvidenceRecordManifestFilename
in classDefaultASiCWithCAdESFilenameFactory
- Parameters:
asicContent
-ASiCContent
representing a content of an ASiC container- Returns:
String
evidence record's manifest filename
-
setEvidenceRecordManifestFilename
-
getValidSignatureFilename
This method returns a valid signature filename- Parameters:
signatureFilename
-String
defined signature filenameasicContent
-ASiCContent
- Returns:
String
signature filename
-
getValidTimestampFilename
This method returns a valid timestamp filename- Parameters:
timestampFilename
-String
defined timestamp filenameasicContent
-ASiCContent
- Returns:
String
timestamp filename
-
getValidEvidenceRecordFilename
protected String getValidEvidenceRecordFilename(String evidenceRecordFilename, ASiCContent asicContent, EvidenceRecordTypeEnum evidenceRecordType) This method returns a valid evidence record filename- Parameters:
evidenceRecordFilename
-String
defined evidence record filenameasicContent
-ASiCContent
evidenceRecordType
-EvidenceRecordTypeEnum
- Returns:
String
evidence record filename
-
getValidManifestFilename
This method returns a valid manifest filename- Parameters:
manifestFilename
-String
defined manifest filenameasicContent
-ASiCContent
- Returns:
String
manifest filename
-
getValidArchiveManifestFilename
protected String getValidArchiveManifestFilename(String archiveManifestFilename, ASiCContent asicContent) This method returns a valid archive manifest filename. NOTE: The name of the archive manifest file shall be: - ASiC-E with CAdES : "META-INF/ASiCArchiveManifest*.xml". "META-INF/" is optional.- Parameters:
archiveManifestFilename
-String
defines archive manifest filenameasicContent
-ASiCContent
- Returns:
String
archive manifest filename
-