Coverage Report - org.mule.tools.visualizer.util.VelocityLogger
 
Classes in this File Line Coverage Branch Coverage Complexity
VelocityLogger
77%
10/13
67%
4/6
1.4
 
 1  
 /*
 2  
  * $Id: VelocityLogger.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.tools.visualizer.util;
 12  
 
 13  
 import org.mule.tools.visualizer.config.GraphEnvironment;
 14  
 
 15  
 import org.apache.velocity.runtime.RuntimeServices;
 16  
 import org.apache.velocity.runtime.log.LogSystem;
 17  
 
 18  
 public class VelocityLogger implements LogSystem
 19  
 {
 20  
     private final boolean debugEnabled;
 21  
 
 22  12
     private GraphEnvironment environment = null;
 23  
 
 24  
     public VelocityLogger(GraphEnvironment environment)
 25  12
     {
 26  12
         this.environment = environment;
 27  12
         this.debugEnabled = environment.getConfig().isDebug();
 28  12
     }
 29  
 
 30  
     public void init(RuntimeServices arg0) throws Exception
 31  
     {
 32  
         // nothing to do
 33  12
     }
 34  
 
 35  
     public void logVelocityMessage(int arg0, String arg1)
 36  
     {
 37  384
         if (environment != null)
 38  
         {
 39  384
             if(arg0 >= ERROR_ID || debugEnabled)
 40  
             {
 41  12
                 environment.log(arg1);
 42  
             }
 43  
         }
 44  384
     }
 45  
 
 46  
     public GraphEnvironment getEnvironment()
 47  
     {
 48  0
         return environment;
 49  
     }
 50  
 
 51  
     public void setEnvironment(GraphEnvironment environment)
 52  
     {
 53  0
         this.environment = environment;
 54  0
     }
 55  
 
 56  
 }