Class XMLValidationTaskDao
java.lang.Object
cf.maybelambda.httpvalidator.springboot.persistence.XMLValidationTaskDao
Provides methods to interact with the XML data file containing validation tasks.
This class is responsible for reading and updating the XML data file, parsing its content, and validating its structure against a predefined schema.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAll()
Retrieves all validation tasks; from the XML data file if it was modified since the last time it was read, or from memory otherwise.boolean
Checks if the XML data file exists and is readable.void
updateDataFile
(org.springframework.web.multipart.MultipartFile file) Updates the XML data file with the content of the given multipart file.
-
Constructor Details
-
XMLValidationTaskDao
Constructs an instance of XMLValidationTaskDao.Initializes the XML parser with schema validation and security features.
- Throws:
ParserConfigurationException
- if a DocumentBuilder cannot be created.SAXException
- if an error occurs during schema parsing.IOException
- if an error occurs during schema file loading.
-
-
Method Details
-
updateDataFile
public void updateDataFile(org.springframework.web.multipart.MultipartFile file) throws IOException, NullPointerException, XMLParseException Updates the XML data file with the content of the given multipart file.- Parameters:
file
- The multipart file containing the new XML content.- Throws:
IOException
- if an I/O error occurs.NullPointerException
- if the file is null.XMLParseException
- if the XML content is invalid.
-
getAll
Retrieves all validation tasks; from the XML data file if it was modified since the last time it was read, or from memory otherwise.- Returns:
- A list of validation tasks.
- Throws:
XMLParseException
- if parsing fails.FileNotFoundException
- if the data file is not found.
-
isDataFileStatusOk
public boolean isDataFileStatusOk()Checks if the XML data file exists and is readable.- Returns:
- True if the data file exists and is readable, false otherwise.
-