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 
18 #if !defined(_LOG4CXX_ROLLING_ROLLOVER_DESCRIPTION_H)
19 #define _LOG4CXX_ROLLING_ROLLOVER_DESCRIPTION_H
20 
21 #include <log4cxx/portability.h>
22 #include <log4cxx/rolling/action.h>
23 
24 namespace log4cxx
25 {
26 namespace rolling
27 {
28 
29 
30 class RolloverDescription : public log4cxx::helpers::ObjectImpl
31 {
32 		DECLARE_LOG4CXX_OBJECT(RolloverDescription)
33 		BEGIN_LOG4CXX_CAST_MAP()
34 		LOG4CXX_CAST_ENTRY(RolloverDescription)
35 		END_LOG4CXX_CAST_MAP()
36 		/**
37 		 * Active log file name after rollover.
38 		 */
39 		LogString activeFileName;
40 
41 		/**
42 		 * Should active file be opened for appending.
43 		 */
44 		bool append;
45 
46 		/**
47 		 * Action to be completed after close of current active log file
48 		 * before returning control to caller.
49 		 */
50 		ActionPtr synchronous;
51 
52 		/**
53 		 * Action to be completed after close of current active log file
54 		 * and before next rollover attempt, may be executed asynchronously.
55 		 */
56 		ActionPtr asynchronous;
57 
58 	public:
59 		RolloverDescription();
60 		/**
61 		 * Create new instance.
62 		 * @param activeFileName active log file name after rollover, may not be null.
63 		 * @param append true if active log file after rollover should be opened for appending.
64 		 * @param synchronous action to be completed after close of current active log file, may be null.
65 		 * @param asynchronous action to be completed after close of current active log file and
66 		 * before next rollover attempt.
67 		 */
68 		RolloverDescription(
69 			const LogString& activeFileName,
70 			const bool append,
71 			const ActionPtr& synchronous,
72 			const ActionPtr& asynchronous);
73 
74 		/**
75 		 * Active log file name after rollover.
76 		 * @return active log file name after rollover.
77 		 */
78 		LogString getActiveFileName() const;
79 
80 		bool getAppend() const;
81 
82 		/**
83 		 * Action to be completed after close of current active log file
84 		 * before returning control to caller.
85 		 *
86 		 * @return action, may be null.
87 		 */
88 		ActionPtr getSynchronous() const;
89 
90 		/**
91 		 * Action to be completed after close of current active log file
92 		 * and before next rollover attempt, may be executed asynchronously.
93 		 *
94 		 * @return action, may be null.
95 		 */
96 		ActionPtr getAsynchronous() const;
97 };
98 
99 LOG4CXX_PTR_DEF(RolloverDescription);
100 
101 }
102 }
103 #endif
104 
105