1 /** 2 * Logback: the reliable, generic, fast and flexible logging framework. 3 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 4 * 5 * This program and the accompanying materials are dual-licensed under 6 * either the terms of the Eclipse Public License v1.0 as published by 7 * the Eclipse Foundation 8 * 9 * or (per the licensee's choosing) 10 * 11 * under the terms of the GNU Lesser General Public License version 2.1 12 * as published by the Free Software Foundation. 13 */ 14 package ch.qos.logback.core.rolling; 15 16 import ch.qos.logback.core.rolling.helper.ArchiveRemover; 17 import ch.qos.logback.core.spi.ContextAware; 18 19 /** 20 * This interface lists the set of methods that need to be implemented by 21 * triggering policies which are nested within a {@link TimeBasedRollingPolicy}. 22 * 23 * @author Ceki Gülcü 24 * 25 * @param <E> 26 */ 27 public interface TimeBasedFileNamingAndTriggeringPolicy<E> extends TriggeringPolicy<E>, ContextAware { 28 29 /** 30 * Set the host/parent {@link TimeBasedRollingPolicy}. 31 * 32 * @param tbrp parent TimeBasedRollingPolicy 33 */ 34 void setTimeBasedRollingPolicy(TimeBasedRollingPolicy<E> tbrp); 35 36 /** 37 * Return the file name for the elapsed periods file name. 38 * 39 * @return 40 */ 41 String getElapsedPeriodsFileName(); 42 43 /** 44 * Return the current periods file name without the compression suffix. This 45 * value is equivalent to the active file name. 46 * 47 * @return current period's file name (without compression suffix) 48 */ 49 String getCurrentPeriodsFileNameWithoutCompressionSuffix(); 50 51 /** 52 * Return the archive remover appropriate for this instance. 53 */ 54 ArchiveRemover getArchiveRemover(); 55 56 /** 57 * Return the current time which is usually the value returned by 58 * System.currentMillis(). However, for <b>testing</b> purposed this value may 59 * be different than the real time. 60 * 61 * @return current time value 62 */ 63 long getCurrentTime(); 64 65 /** 66 * Set the current time. Only unit tests should invoke this method. 67 * 68 * @param now 69 */ 70 void setCurrentTime(long now); 71 72 /** 73 * Set some date in the current period. Only unit tests should invoke this 74 * method. 75 * 76 * WARNING: method removed. A unit test should not set the date in current 77 * period. It is the job of the FNATP to compute that. 78 * 79 * @param date 80 */ 81 // void setDateInCurrentPeriod(Date date); 82 }