Package gov.nasa.pds.tools.util
Class DocumentsChecker
java.lang.Object
gov.nasa.pds.tools.util.DocumentsChecker
A class that validate if a document file is valid based on the file name. This class relies on
the MimetypesFileTypeMap class to load a default MIME types file that maps a mime type to file
extensions. Come time to check for the correct mime type, this map will be used to check for the
user provided mime type against the mime type defined in the file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetPossibleFileExtensions(String documentStandardId) Given a document standard id, returns a list of possible file extensions associated with that id.booleanisMimeTypeCorrect(String documentRef, String documentStandardId) Given a document file name, check for the mime type matches in the defined default filename.
-
Constructor Details
-
DocumentsChecker
public DocumentsChecker()
-
-
Method Details
-
getPossibleFileExtensions
Given a document standard id, returns a list of possible file extensions associated with that id.- Parameters:
documentStandardId- The document standard id as defined by the PDS Information Model document.- Returns:
- extensionList List of file extensions allowed for that document standard id.
-
isMimeTypeCorrect
Given a document file name, check for the mime type matches in the defined default filename.- Parameters:
documentRef- The file name of the documentdocumentStandardId- The document standard id as defined by the PDS Information Model document.- Returns:
- true if the mime type matches with was defined, false otherwise.
-