Coverage Report - org.apache.camel.builder.LoggingErrorHandlerBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
LoggingErrorHandlerBuilder
27% 
N/A 
1
 
 1  
 /**
 2  
  *
 3  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 4  
  * contributor license agreements.  See the NOTICE file distributed with
 5  
  * this work for additional information regarding copyright ownership.
 6  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 7  
  * (the "License"); you may not use this file except in compliance with
 8  
  * the License.  You may obtain a copy of the License at
 9  
  *
 10  
  * http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 package org.apache.camel.builder;
 19  
 
 20  
 import org.apache.camel.Exchange;
 21  
 import org.apache.camel.Processor;
 22  
 import org.apache.camel.processor.Logger;
 23  
 import org.apache.camel.processor.LoggingErrorHandler;
 24  
 import org.apache.camel.processor.LoggingLevel;
 25  
 import org.apache.commons.logging.Log;
 26  
 import org.apache.commons.logging.LogFactory;
 27  
 
 28  
 /**
 29  
  * Uses the {@link Logger} as an error handler
 30  
  * 
 31  
  * @version $Revision: 534145 $
 32  
  */
 33  
 public class LoggingErrorHandlerBuilder implements ErrorHandlerBuilder {
 34  1
     private Log log = LogFactory.getLog(Logger.class);
 35  1
     private LoggingLevel level = LoggingLevel.INFO;
 36  
 
 37  0
     public LoggingErrorHandlerBuilder() {
 38  0
     }
 39  
 
 40  1
     public LoggingErrorHandlerBuilder(Log log) {
 41  1
         this.log = log;
 42  1
     }
 43  
 
 44  0
     public LoggingErrorHandlerBuilder(Log log, LoggingLevel level) {
 45  0
         this.log = log;
 46  0
         this.level = level;
 47  0
     }
 48  
 
 49  
     public ErrorHandlerBuilder copy() {
 50  0
         LoggingErrorHandlerBuilder answer = new LoggingErrorHandlerBuilder();
 51  0
         answer.setLog(getLog());
 52  0
         answer.setLevel(getLevel());
 53  0
         return answer;
 54  
     }
 55  
 
 56  
     public Processor createErrorHandler(Processor processor) {
 57  1
         return new LoggingErrorHandler(processor, log, level);
 58  
     }
 59  
 
 60  
     public LoggingLevel getLevel() {
 61  0
         return level;
 62  
     }
 63  
 
 64  
     public void setLevel(LoggingLevel level) {
 65  0
         this.level = level;
 66  0
     }
 67  
 
 68  
     public Log getLog() {
 69  0
         return log;
 70  
     }
 71  
 
 72  
     public void setLog(Log log) {
 73  0
         this.log = log;
 74  0
     }
 75  
 }