View Javadoc

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