001/**
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.core.rolling;
015
016import ch.qos.logback.core.rolling.helper.ArchiveRemover;
017import ch.qos.logback.core.spi.ContextAware;
018
019/**
020 * This interface lists the set of methods that need to be implemented by
021 * triggering policies which are nested within a {@link TimeBasedRollingPolicy}.
022 * 
023 * @author Ceki Gülcü
024 * 
025 * @param <E>
026 */
027public interface TimeBasedFileNamingAndTriggeringPolicy<E> extends TriggeringPolicy<E>, ContextAware {
028
029    /**
030     * Set the host/parent {@link TimeBasedRollingPolicy}.
031     * 
032     * @param tbrp parent TimeBasedRollingPolicy
033     */
034    void setTimeBasedRollingPolicy(TimeBasedRollingPolicy<E> tbrp);
035
036    /**
037     * Return the file name for the elapsed periods file name.
038     * 
039     * @return
040     */
041    String getElapsedPeriodsFileName();
042
043    /**
044     * Return the current periods file name without the compression suffix. This
045     * value is equivalent to the active file name.
046     * 
047     * @return current period's file name (without compression suffix)
048     */
049    String getCurrentPeriodsFileNameWithoutCompressionSuffix();
050
051    /**
052     * Return the archive remover appropriate for this instance.
053     */
054    ArchiveRemover getArchiveRemover();
055
056    /**
057     * Return the current time which is usually the value returned by
058     * System.currentMillis(). However, for <b>testing</b> purposed this value may
059     * be different than the real time.
060     * 
061     * @return current time value
062     */
063    long getCurrentTime();
064
065    /**
066     * Set the current time. Only unit tests should invoke this method.
067     * 
068     * @param now
069     */
070    void setCurrentTime(long now);
071
072    /**
073     * Set some date in the current period. Only unit tests should invoke this
074     * method.
075     * 
076     * WARNING: method removed. A unit test should not set the date in current
077     * period. It is the job of the FNATP to compute that.
078     * 
079     * @param date
080     */
081    // void setDateInCurrentPeriod(Date date);
082}