KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > grlea > log > rollover > RolloverStrategy


1 package org.grlea.log.rollover;
2
3 // $Id: RolloverStrategy.java,v 1.2 2006/07/13 12:39:15 grlea Exp $
4
// Copyright (c) 2004-2006 Graham Lea. All rights reserved.
5

6 // Licensed under the Apache License, Version 2.0 (the "License");
7
// you may not use this file except in compliance with the License.
8
// 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 import java.io.IOException JavaDoc;
19 import java.util.Date JavaDoc;
20 import java.util.Map JavaDoc;
21
22 /**
23  * <p>An interface for objects that wish to be able to decide when log files should be rolled over.
24  * </p>
25  *
26  * @author Graham Lea
27  * @version $Revision: 1.2 $
28  */

29 public interface
30 RolloverStrategy
31 {
32    /**
33     * Reads from the given map any properties that affect the behaviour of this strategy.
34     *
35     * @param properties an unmodifiable map of properties, i.e. String keys with String values
36     *
37     * @throws IOException if an error occurs while configuring the strategy.
38     */

39    public void
40    configure(Map JavaDoc properties)
41    throws IOException JavaDoc;
42
43    /**
44     * Decides whether or not the log file should be rolled over immediately.
45     *
46     * @param fileCreated the date and time at which the current log file was created
47     * @param fileLength the current length of the log file
48     *
49     * @return <code>true</code> if the log file should be rolled over now, <code>false</code> if it
50     * should not.
51     */

52    public boolean
53    rolloverNow(Date JavaDoc fileCreated, long fileLength);
54 }
Popular Tags