001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.camel.builder;
018    
019    import java.util.List;
020    
021    import org.apache.camel.ErrorHandlerFactory;
022    import org.apache.camel.model.OnExceptionDefinition;
023    import org.apache.camel.processor.ErrorHandler;
024    import org.apache.camel.processor.exceptionpolicy.ExceptionPolicyStrategy;
025    import org.apache.camel.spi.RouteContext;
026    
027    /**
028     * A builder of a <a href="http://camel.apache.org/error-handler.html">Error Handler</a>
029     *
030     * @version 
031     */
032    public interface ErrorHandlerBuilder extends ErrorHandlerFactory {
033    
034        /**
035         * Adds error handler for the given exception type
036         *
037         * @param exception  the exception to handle
038         */
039        void addErrorHandlers(OnExceptionDefinition exception);
040    
041        /**
042         * Adds the error handlers for the given list of exception types
043         *
044         * @param exceptions  the list of exceptions to handle
045         */
046        void setErrorHandlers(List<OnExceptionDefinition> exceptions);
047    
048        /**
049         * Gets the error handlers
050         */
051        List<OnExceptionDefinition> getErrorHandlers();
052    
053        /**
054         * Gets the exception policy strategy
055         */
056        ExceptionPolicyStrategy getExceptionPolicyStrategy();
057    
058        /**
059         * Sets the exception policy strategy to use for resolving the {@link org.apache.camel.model.OnExceptionDefinition}
060         * to use for a given thrown exception
061         *
062         * @param exceptionPolicyStrategy  the exception policy strategy
063         */
064        void setExceptionPolicyStrategy(ExceptionPolicyStrategy exceptionPolicyStrategy);
065    
066        /**
067         * Whether this error handler supports transacted exchanges.
068         */
069        boolean supportTransacted();
070    
071        /**
072         * Configures the other error handler based on this error handler.
073         *
074         * @param routeContext the route context
075         * @param handler the other error handler
076         */
077        void configure(RouteContext routeContext, ErrorHandler handler);
078    }