Class FileValidator
- java.lang.Object
-
- com.sun.enterprise.admin.servermgmt.Validator
-
- com.sun.enterprise.admin.servermgmt.FileValidator
-
public class FileValidator extends Validator
This class performs the file related validations such as-
existence of the file
read, write & execute permissions,
whether the file is a directory or a file
-
-
Field Summary
Fields Modifier and Type Field Description static String
VALID_CONSTRAINTS
The valid constraint set.
-
Constructor Summary
Constructors Constructor Description FileValidator(String name, String constraints)
Constructs a new FileValidator object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getConstraints()
String
setConstraints(String constraints)
Sets the current constraint set to the given set if it is a valid constraint set.void
validate(Object str)
Validates the given File.
-
-
-
Field Detail
-
VALID_CONSTRAINTS
public static final String VALID_CONSTRAINTS
The valid constraint set.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileValidator
public FileValidator(String name, String constraints)
Constructs a new FileValidator object.- Parameters:
name
- The name of the entity that will be validated. This name is used in the error message.constraints
- The constraint set that will be checked for any given file during validation.
-
-
Method Detail
-
getConstraints
public String getConstraints()
- Returns:
- Returns the current constraint set.
-
setConstraints
public String setConstraints(String constraints)
Sets the current constraint set to the given set if it is a valid constraint set.- Parameters:
constraints
- the file permission constraints, may be characters in the form 'drwx'- Returns:
- the resulting constraints. If the given constrains was not valid, then the previous constraints will be returned.
-
validate
public void validate(Object str) throws InvalidConfigException
Validates the given File.- Overrides:
validate
in classValidator
- Parameters:
str
- Must be the absolute path of the File that will be validated.- Throws:
InvalidConfigException
-
-