001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2006-2008 Sun Microsystems, Inc. 025 * Portions Copyright 2014-2015 ForgeRock AS 026 */ 027package org.opends.server.loggers; 028 029import org.opends.server.admin.std.server.LogRotationPolicyCfg; 030import org.opends.server.types.InitializationException; 031import org.forgerock.opendj.config.server.ConfigException; 032 033 034/** 035 * This interface describes the rotation policy that should be used 036 * for the logger. Supported policies include size based and time 037 * based. 038 * 039 * @param <T> The type of rotation policy configuration handled by 040 * this retention policy implementation. 041 */ 042public interface RotationPolicy<T extends LogRotationPolicyCfg> 043{ 044 /** 045 * Initializes this log rotation policy based on the 046 * information in the provided rotation policy configuration. 047 * 048 * @param config 049 * The rotation policy configuration that contains the 050 * information to use to initialize this policy. 051 * @throws ConfigException 052 * If an unrecoverable problem arises in the process of 053 * performing the initialization as a result of the server 054 * configuration. 055 * @throws InitializationException 056 * If a problem occurs during initialization that is not 057 * related to the server configuration. 058 */ 059 void initializeLogRotationPolicy(T config) 060 throws ConfigException, InitializationException; 061 062 063 /** 064 * This method indicates if the log file should be rotated or not. 065 * 066 * @param writer 067 * the file writer to be checked. 068 * @return true if the log file should be rotated, false otherwise. 069 */ 070 boolean rotateFile(RotatableLogFile writer); 071 072 073} 074