lumis.portal.file
Interface IFileValidator

Package class diagram package IFileValidator

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 the validate(FileConfig) method.

To configure the custom validators used by file repositories, define, in the property bag of the file repository's service instance channel, 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
See Also:
IFileManager

Method Summary
 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


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.