Coverage Report - org.apache.camel.builder.LoggingErrorHandlerBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
LoggingErrorHandlerBuilder
33% 
N/A 
1
 
 1  
 /**
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  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  
 package org.apache.camel.builder;
 18  
 
 19  
 import org.apache.camel.Processor;
 20  
 import org.apache.camel.processor.Logger;
 21  
 import org.apache.camel.processor.LoggingErrorHandler;
 22  
 import org.apache.camel.processor.LoggingLevel;
 23  
 import org.apache.camel.processor.ErrorHandlerSupport;
 24  
 import org.apache.commons.logging.Log;
 25  
 import org.apache.commons.logging.LogFactory;
 26  
 
 27  
 /**
 28  
  * Uses the {@link Logger} as an error handler
 29  
  *
 30  
  * @version $Revision: 564295 $
 31  
  */
 32  
 public class LoggingErrorHandlerBuilder extends ErrorHandlerBuilderSupport {
 33  3
     private Log log = LogFactory.getLog(Logger.class);
 34  3
     private LoggingLevel level = LoggingLevel.INFO;
 35  
 
 36  0
     public LoggingErrorHandlerBuilder() {
 37  0
     }
 38  
 
 39  3
     public LoggingErrorHandlerBuilder(Log log) {
 40  3
         this.log = log;
 41  3
     }
 42  
 
 43  0
     public LoggingErrorHandlerBuilder(Log log, LoggingLevel level) {
 44  0
         this.log = log;
 45  0
         this.level = level;
 46  0
     }
 47  
 
 48  
     public ErrorHandlerBuilder copy() {
 49  0
         LoggingErrorHandlerBuilder answer = new LoggingErrorHandlerBuilder();
 50  0
         answer.setLog(getLog());
 51  0
         answer.setLevel(getLevel());
 52  0
         return answer;
 53  
     }
 54  
 
 55  
     public Processor createErrorHandler(Processor processor) {
 56  3
         LoggingErrorHandler handler = new LoggingErrorHandler(processor, log, level);
 57  3
         configure(handler);
 58  3
         return handler;
 59  
     }
 60  
 
 61  
     public LoggingLevel getLevel() {
 62  0
         return level;
 63  
     }
 64  
 
 65  
     public void setLevel(LoggingLevel level) {
 66  0
         this.level = level;
 67  0
     }
 68  
 
 69  
     public Log getLog() {
 70  0
         return log;
 71  
     }
 72  
 
 73  
     public void setLog(Log log) {
 74  0
         this.log = log;
 75  0
     }
 76  
 }