Interface IFileValidator
-
- All Known Implementing Classes:
ExtensionFileValidator
public interface IFileValidator
Interface to validate a file.It's possible make a custom class validator for a
file repository
. For that, implement this interface, defining the validation behavior on thevalidate(FileConfig)
method.To configure the custom validators used by file repositories, define, in the property bag of the file repository's service instance, a property named lumis.portal.file.validation.className, having as its values the custom validator class names.
Example custom validator class:
public class FixedSizeValidator implements IFileValidator { public void validate(FileConfig file) throws FileValidationException, PortalException { if (file.getFileSize() > 1000000) throw new FileValidationException("File size greater than 1000000"); // validation failed } }
- Since:
- 6.0.0
- Version:
- $Revision$ $Date$
- See Also:
IFileManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
validate(FileConfig file)
Validate the metadata of a file.
-
-
-
Method Detail
-
validate
void validate(FileConfig file) throws FileValidationException, PortalException
Validate the metadata of a file. This method executes in the same transactional context as the file inclusion.- Parameters:
file
- The file to be validated.- Throws:
FileValidationException
- If the validation has failed.PortalException
- If any error occurs validating the metadata.- Since:
- 6.0.0
-
-