Class AbstractASiCFilenameFactory

java.lang.Object
eu.europa.esig.dss.asic.common.AbstractASiCFilenameFactory
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DefaultASiCWithCAdESFilenameFactory, DefaultASiCWithXAdESFilenameFactory

public abstract class AbstractASiCFilenameFactory extends Object implements Serializable
This class contains common methods for ASiC filename factory.
See Also:
  • Constructor Details

    • AbstractASiCFilenameFactory

      protected AbstractASiCFilenameFactory()
      Default constructor
  • Method Details

    • getNextAvailableDocumentName

      protected String getNextAvailableDocumentName(String nameTemplate, Collection<String> existingDocumentNames)
      This method returns the next available suffix (i.e. number) for a new file entry across given document names. Ex.: For provided two signature documents, the method will return "003" suffix, to be used for a signature file creation with a name "META-INF/signature003.xml".
      Parameters:
      nameTemplate - String defining the String template of the final name
      existingDocumentNames - a list of String document names forbidden for usage
      Returns:
      String available document name suffix
    • isAvailableName

      protected boolean isAvailableName(String filename, Collection<String> restrictedNames)
      This method verifies whether the filename is not present within restrictedNames
      Parameters:
      filename - String to verify
      restrictedNames - a list of String taken filenames
      Returns:
      TRUE if the filename is available (free) for usage, FALSE otherwise
    • getWithMetaInfFolder

      protected String getWithMetaInfFolder(String filename)
      This method is used to append a "META-INF/" string to the filename, when required.
      Parameters:
      filename - String represented a document filename to be present within "META-INF/" folder
      Returns:
      String
    • assertASiCContentIsValid

      protected void assertASiCContentIsValid(ASiCContent asicContent)
      This method is used to verify whether the provided asicContent contains all the required information for a new filename determination
      Parameters:
      asicContent - ASiCContent to be verified
    • assertFilenameValid

      protected void assertFilenameValid(String filename, List<DSSDocument> documentsOfType)
      This method verifies whether the given filename represents a valid document name within a container
      Parameters:
      filename - String filename to check
      documentsOfType - list of DSSDocument of the same type as a creating document
    • getValidDataPackageFilename

      protected String getValidDataPackageFilename(String dataPackageFilename, ASiCContent asicContent)
      This method returns a valid data package filename
      Parameters:
      dataPackageFilename - String defined data package filename
      asicContent - ASiCContent
      Returns:
      String data package filename