Coverage Report - org.apache.commons.scxml.env.Tracer

Classes in this File Line Coverage Branch Coverage Complexity
Tracer
58% 
N/A 
1

 1  
 /*
 2  
  *
 3  
  *   Copyright 2005 The Apache Software Foundation.
 4  
  *
 5  
  *  Licensed under the Apache License, Version 2.0 (the "License");
 6  
  *  you may not use this file except in compliance with the License.
 7  
  *  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  *  Unless required by applicable law or agreed to in writing, software
 12  
  *  distributed under the License is distributed on an "AS IS" BASIS,
 13  
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  *  See the License for the specific language governing permissions and
 15  
  *  limitations under the License.
 16  
  *
 17  
  */
 18  
 package org.apache.commons.scxml.env;
 19  
 
 20  
 import org.apache.commons.scxml.ErrorReporter;
 21  
 import org.apache.commons.scxml.SCXMLListener;
 22  
 import org.apache.commons.scxml.model.Transition;
 23  
 import org.apache.commons.scxml.model.TransitionTarget;
 24  
 
 25  
 import org.xml.sax.ErrorHandler;
 26  
 import org.xml.sax.SAXException;
 27  
 import org.xml.sax.SAXParseException;
 28  
 
 29  
 /**
 30  
  * A simple tracer connected to Jakarta Commons Logging.
 31  
  *
 32  
  */
 33  
 public class Tracer implements ErrorHandler, ErrorReporter, SCXMLListener {
 34  
 
 35  
     /** ErrorHandler delegate. */
 36  
     private ErrorHandler errHandler;
 37  
     /** ErrorReporter delegate. */
 38  
     private ErrorReporter errReporter;
 39  
     /** SCXMLListener delegate. */
 40  
     private SCXMLListener scxmlListener;
 41  
 
 42  
     /**
 43  
      * Constructor.
 44  
      */
 45  
     public Tracer() {
 46  34
         super();
 47  34
         errHandler = new SimpleErrorHandler();
 48  34
         errReporter = new SimpleErrorReporter();
 49  34
         scxmlListener = new SimpleSCXMLListener();
 50  34
     }
 51  
 
 52  
     /**
 53  
      * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
 54  
      */
 55  
     public void warning(final SAXParseException exception)
 56  
     throws SAXException {
 57  0
         errHandler.warning(exception);
 58  0
     }
 59  
 
 60  
     /**
 61  
      * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
 62  
      */
 63  
     public void error(final SAXParseException exception)
 64  
     throws SAXException {
 65  0
         errHandler.error(exception);
 66  0
     }
 67  
 
 68  
     /**
 69  
      * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
 70  
      */
 71  
     public void fatalError(final SAXParseException exception)
 72  
     throws SAXException {
 73  0
         errHandler.fatalError(exception);
 74  0
     }
 75  
 
 76  
     /**
 77  
      * @see ErrorReporter#onError(String, String, Object)
 78  
      */
 79  
     public void onError(final String errCode, final String errDetail,
 80  
             final Object errCtx) {
 81  0
         errReporter.onError(errCode, errDetail, errCtx);
 82  0
     }
 83  
 
 84  
     /**
 85  
      * @see SCXMLListener#onEntry(TransitionTarget)
 86  
      */
 87  
     public void onEntry(final TransitionTarget target) {
 88  179
         scxmlListener.onEntry(target);
 89  179
     }
 90  
 
 91  
     /**
 92  
      * @see SCXMLListener#onExit(TransitionTarget)
 93  
      */
 94  
     public void onExit(final TransitionTarget target) {
 95  100
         scxmlListener.onExit(target);
 96  100
     }
 97  
 
 98  
     /**
 99  
 * @see SCXMLListener#onTransition(TransitionTarget,TransitionTarget,Transition)
 100  
      */
 101  
     public void onTransition(final TransitionTarget from,
 102  
             final TransitionTarget to, final Transition transition) {
 103  84
         scxmlListener.onTransition(from, to, transition);
 104  84
     }
 105  
 
 106  
 }
 107