Package gov.nasa.pds.tools.util
Class DocumentsChecker
- java.lang.Object
-
- gov.nasa.pds.tools.util.DocumentsChecker
-
public class DocumentsChecker extends Object
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 Constructor Description DocumentsChecker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArrayList<String>
getPossibleFileExtensions(String documentStandardId)
Given a document standard id, returns a list of possible file extensions associated with that id.boolean
isMimeTypeCorrect(String documentRef, String documentStandardId)
Given a document file name, check for the mime type matches in the defined default filename.
-
-
-
Method Detail
-
getPossibleFileExtensions
public ArrayList<String> getPossibleFileExtensions(String documentStandardId)
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
public boolean isMimeTypeCorrect(String documentRef, String documentStandardId)
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.
-
-