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 */
017package org.apache.camel;
018
019/**
020 * Various runtime configuration options used by {@link org.apache.camel.CamelContext} and {@link org.apache.camel.spi.RouteContext}
021 * for cross cutting functions such as tracing, delayer, stream cache and the like.
022 */
023public interface RuntimeConfiguration {
024
025    /**
026     * Sets whether stream caching is enabled or not (default is disabled).
027     *
028     * @param cache whether stream caching is enabled or not
029     */
030    void setStreamCaching(Boolean cache);
031
032    /**
033     * Returns whether stream cache is enabled
034     *
035     * @return <tt>true</tt> if stream cache is enabled
036     */
037    Boolean isStreamCaching();
038
039    /**
040     * Sets whether tracing is enabled or not (default is enabled).
041     *
042     * @param tracing whether to enable tracing.
043     */
044    void setTracing(Boolean tracing);
045
046    /**
047     * Returns whether tracing enabled
048     *
049     * @return <tt>true</tt> if tracing is enabled
050     */
051    Boolean isTracing();
052
053    /**
054     * Sets whether debugging is enabled or not (default is enabled).
055     *
056     * @param debugging whether to enable debugging.
057     */
058    void setDebugging(Boolean debugging);
059
060    /**
061     * Returns whether debugging enabled
062     *
063     * @return <tt>true</tt> if tracing is enabled
064     */
065    Boolean isDebugging();
066
067    /**
068     * Sets whether message history is enabled or not (default is enabled).
069     *
070     * @param messageHistory whether message history is enabled
071     */
072    void setMessageHistory(Boolean messageHistory);
073
074    /**
075     * Returns whether message history is enabled
076     *
077     * @return <tt>true</tt> if message history is enabled
078     */
079    Boolean isMessageHistory();
080
081    /**
082     * Sets whether security mask for Logging is enabled or not (default is disabled).
083     * 
084     * @param logMask <tt>true</tt> if mask is enabled
085     */
086    void setLogMask(Boolean logMask);
087
088    /**
089     * Gets whether security mask for Logging is enabled or not.
090     * 
091     * @return <tt>true</tt> if mask is enabled
092     */
093    Boolean isLogMask();
094
095    /**
096     * Sets whether to log exhausted message body with message history.
097     *
098     * @param logExhaustedMessageBody whether message body should be logged
099     */
100    void setLogExhaustedMessageBody(Boolean logExhaustedMessageBody);
101
102    /**
103     * Returns whether to log exhausted message body with message history.
104     * 
105     * @return <tt>true</tt> if logging of message body is enabled
106     */
107    Boolean isLogExhaustedMessageBody();
108
109    /**
110     * Sets whether fault handling is enabled or not (default is disabled).
111     *
112     * @param handleFault whether to enable fault handling.
113     */
114    void setHandleFault(Boolean handleFault);
115
116    /**
117     * Returns whether fault handling enabled
118     *
119     * @return <tt>true</tt> if fault handling is enabled
120     */
121    Boolean isHandleFault();
122
123    /**
124     * Sets a delay value in millis that a message is delayed at every step it takes in the route path,
125     * slowing the process down to better observe what is occurring
126     * <p/>
127     * Is disabled by default
128     *
129     * @param delay delay in millis
130     */
131    void setDelayer(Long delay);
132
133    /**
134     * Gets the delay value
135     *
136     * @return delay in millis, or <tt>null</tt> if disabled
137     */
138    Long getDelayer();
139
140    /**
141     * Sets whether the object should automatically start when Camel starts.
142     * <p/>
143     * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started.
144     * <br/>
145     * <b>Note:</b> When setting auto startup <tt>false</tt> on {@link CamelContext} then that takes precedence
146     * and <i>no</i> routes is started. You would need to start {@link CamelContext} explicit using
147     * the {@link org.apache.camel.CamelContext#start()} method, to start the context, and then
148     * you would need to start the routes manually using {@link org.apache.camel.spi.RouteController#startRoute(String)}.
149     * <p/>
150     * Default is <tt>true</tt> to always start up.
151     *
152     * @param autoStartup whether to start up automatically.
153     */
154    void setAutoStartup(Boolean autoStartup);
155
156    /**
157     * Gets whether the object should automatically start when Camel starts.
158     * <p/>
159     * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started.
160     * <br/>
161     * Default is <tt>true</tt> to always start up.
162     *
163     * @return <tt>true</tt> if object should automatically start
164     */
165    Boolean isAutoStartup();
166
167    /**
168     * Sets the ShutdownRoute option for routes.
169     *
170     * @param shutdownRoute the option to use.
171     */
172    void setShutdownRoute(ShutdownRoute shutdownRoute);
173
174    /**
175     * Gets the option to use when shutting down the route.
176     *
177     * @return the option
178     */
179    ShutdownRoute getShutdownRoute();
180
181    /**
182     * Sets the ShutdownRunningTask option to use when shutting down a route.
183     *
184     * @param shutdownRunningTask the option to use.
185     */
186    void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask);
187
188    /**
189     * Gets the ShutdownRunningTask option in use when shutting down a route.
190     *
191     * @return the option
192     */
193    ShutdownRunningTask getShutdownRunningTask();
194
195    /**
196     * Sets whether to allow access to the original message from Camel's error handler,
197     * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()}.
198     * <p/>
199     * Turning this off can optimize performance, as defensive copy of the original message is not needed.
200     *
201     * @param allowUseOriginalMessage the option to use.
202     */
203    void setAllowUseOriginalMessage(Boolean allowUseOriginalMessage);
204
205    /**
206     * Gets whether access to the original message from Camel's error handler,
207     * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()} is allowed.
208     *
209     * @return the option
210     */
211    Boolean isAllowUseOriginalMessage();
212
213}