Coverage Report - org.apache.commons.latka.validators.BaseValidator
 
Classes in this File Line Coverage Branch Coverage Complexity
BaseValidator
0%
0/11
0%
0/2
1.167
 
 1  
 /*
 2  
  * Copyright 1999-2002,2004 The Apache Software Foundation.
 3  
  * 
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  * 
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  * 
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.apache.commons.latka.validators;   
 18  
 
 19  
 import org.apache.commons.latka.Validator;
 20  
 import org.apache.commons.latka.ValidationException;
 21  
 
 22  
 import org.apache.commons.latka.http.Response;
 23  
 
 24  
 import org.apache.log4j.Category;
 25  
 
 26  
 /**
 27  
  * @author Rodney Waldhoff
 28  
  * @author dIon Gillard
 29  
  * @version $Id: BaseValidator.java 155424 2005-02-26 13:09:29Z dirkv $
 30  
  */
 31  
 public abstract class BaseValidator implements Validator {
 32  
     // ----------------------------------------------------- Instance Variables 
 33  
 
 34  
     /** log4j category for debug output */
 35  0
     protected final Category _log = Category.getInstance(BaseValidator.class);
 36  
 
 37  
     // ------------------------------------------------------- Abstract Methods
 38  
     /**
 39  
      * Validate a response
 40  
      * 
 41  
      * @param response the response to validate
 42  
      * @throws ValidationException 
 43  
      */
 44  
     public abstract void validate(Response response) throws ValidationException;
 45  
 
 46  0
     protected String _label = null;
 47  
 
 48  
     // ----------------------------------------------------------- Constructors
 49  
 
 50  
     public BaseValidator() {
 51  0
         this(null);
 52  0
     }
 53  
 
 54  0
     public BaseValidator(String label) {
 55  0
         _label = label;
 56  0
     }
 57  
 
 58  
     // ---------------------------------------------------------------- Methods
 59  
 
 60  
     public void setLabel(String label) {
 61  0
         _label = label;
 62  0
     }
 63  
 
 64  
     public String getLabel() {
 65  0
         return _label;
 66  
     }
 67  
 
 68  
     protected void fail(String reason) throws ValidationException {
 69  0
         throw new ValidationException(getLabel(),reason);
 70  
     }
 71  
 
 72  
 }