KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > services > intake > validator > FileValidator


1 package org.apache.turbine.services.intake.validator;
2
3 /*
4  * Copyright 2001-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License")
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
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 JavaDoc;
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,v 1.8.2.2 2004/05/20 03:06:47 seade Exp $
37  */

38 public class FileValidator
39         extends DefaultValidator
40 {
41
42     /**
43      *
44      * Constructor
45      *
46      * @param paramMap a <code>Map</code> of <code>rule</code>'s
47      * containing constraints on the input.
48      * @exception InvalidMaskException an invalid mask was specified
49      */

50     public FileValidator(Map JavaDoc paramMap)
51             throws IntakeException
52     {
53         init(paramMap);
54     }
55
56     /**
57      * Default constructor
58      */

59     public FileValidator()
60     {
61     }
62
63     /**
64      * Determine whether a testValue meets the criteria specified
65      * in the constraints defined for this validator
66      *
67      * @param testValue a <code>FileItem</code> to be tested
68      * @exception ValidationException containing an error message if the
69      * testValue did not pass the validation tests.
70      */

71     public void assertValidity(FileItem testValue)
72             throws ValidationException
73     {
74         super.assertValidity(testValue.getString());
75     }
76 }
77
Popular Tags