Coverage Report - org.webmacro.engine.EvaluationExceptionHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
EvaluationExceptionHandler
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright (C) 1998-2001 Semiotek Inc.  All Rights Reserved.
 3  
  *
 4  
  * Redistribution and use in source and binary forms, with or without
 5  
  * modification, are permitted under the terms of either of the following
 6  
  * Open Source licenses:
 7  
  *
 8  
  * The GNU General Public License, version 2, or any later version, as
 9  
  * published by the Free Software Foundation
 10  
  * (http://www.fsf.org/copyleft/gpl.html);
 11  
  *
 12  
  *  or
 13  
  *
 14  
  * The Semiotek Public License (http://webmacro.org/LICENSE.)
 15  
  *
 16  
  * This software is provided "as is", with NO WARRANTY, not even the
 17  
  * implied warranties of fitness to purpose, or merchantability. You
 18  
  * assume all risks and liabilities associated with its use.
 19  
  *
 20  
  * See www.webmacro.org for more information on the WebMacro project.
 21  
  */
 22  
 
 23  
 
 24  
 /**
 25  
  * EvaluationExceptionHandler
 26  
  *
 27  
  * An interface for specifying how certain classes of errors will be
 28  
  * handled.  The handle method is called when an exception is thrown
 29  
  * when trying to expand a variable or property reference.  The error
 30  
  * and warning methods are called from directives and context tools to
 31  
  * generate output warnings.  Any of these routines may throw exceptions,
 32  
  * in which case the enclosing servlet will catch it and generate an error
 33  
  * which the user sees (useful for debugging.)
 34  
  *
 35  
  * @author Brian Goetz
 36  
  * @since 0.96 */
 37  
 
 38  
 package org.webmacro.engine;
 39  
 
 40  
 import org.webmacro.Broker;
 41  
 import org.webmacro.Context;
 42  
 import org.webmacro.PropertyException;
 43  
 import org.webmacro.util.Settings;
 44  
 
 45  
 /**
 46  
  * Handler for Exceptions generated during property evaluation.
 47  
  * 
 48  
  * @since  0.96
 49  
  *
 50  
  */
 51  
 public interface EvaluationExceptionHandler
 52  
 {
 53  
 
 54  
     /**
 55  
      * Initialize the EEH.
 56  
      */
 57  
     public void init (Broker b, Settings config);
 58  
 
 59  
     /**
 60  
      * When an exception is detected in the process of expanding (writing)
 61  
      * a variable reference, this method is consulted.  It either throws
 62  
      * an exception, or it returns a String which can be written to the
 63  
      * output in place of the property expansion.
 64  
      */
 65  
     public String expand (Variable variable,
 66  
                           Context context,
 67  
                           Exception problem)
 68  
             throws PropertyException;
 69  
 
 70  
     /**
 71  
      * When an exception is detected in the process of evaluating
 72  
      * a variable reference, this method is consulted.  It either returns,
 73  
      * in which case the caller is supposed to supply a default value (like
 74  
      * null), or will throw.
 75  
      */
 76  
     public void evaluate (Variable variable,
 77  
                           Context context,
 78  
                           Exception problem)
 79  
             throws PropertyException;
 80  
 
 81  
     public String warningString (String warningText)
 82  
             throws PropertyException;
 83  
 
 84  
     public String errorString (String errorText)
 85  
             throws PropertyException;
 86  
 
 87  
 }