01: package org.apache.turbine.services.intake.validator;
02:
03: /*
04: * Copyright 2001-2005 The Apache Software Foundation.
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License")
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.util.Map;
20:
21: import org.apache.commons.fileupload.FileItem;
22:
23: import org.apache.turbine.services.intake.IntakeException;
24:
25: /**
26: * A validator that will compare a FileItem testValue against the following
27: * constraints in addition to those listed in DefaultValidator.
28: *
29: *
30: *
31: * This validator can serve as the base class for more specific validators
32: *
33: * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
34: * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
35: * @author <a href="mailto:Colin.Chalmers@maxware.nl">Colin Chalmers</a>
36: * @version $Id: FileValidator.java 264148 2005-08-29 14:21:04Z henning $
37: */
38: public class FileValidator extends DefaultValidator {
39:
40: /**
41: *
42: * Constructor
43: *
44: * @param paramMap a <code>Map</code> of <code>rule</code>'s
45: * containing constraints on the input.
46: * @exception InvalidMaskException an invalid mask was specified
47: */
48: public FileValidator(Map paramMap) throws IntakeException {
49: init(paramMap);
50: }
51:
52: /**
53: * Default constructor
54: */
55: public FileValidator() {
56: }
57:
58: /**
59: * Determine whether a testValue meets the criteria specified
60: * in the constraints defined for this validator
61: *
62: * @param testValue a <code>FileItem</code> to be tested
63: * @exception ValidationException containing an error message if the
64: * testValue did not pass the validation tests.
65: */
66: public void assertValidity(FileItem testValue)
67: throws ValidationException {
68: super.assertValidity(testValue.getString());
69: }
70: }
|