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
010 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 * Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 * Copyright 2006-2008 Sun Microsystems, Inc.
026 */
027 package org.opends.server.loggers;
028
029 import org.opends.server.admin.std.server.LogRotationPolicyCfg;
030 import org.opends.server.types.InitializationException;
031 import org.opends.server.config.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 */
042 public 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 public abstract void initializeLogRotationPolicy(T config)
060 throws ConfigException, InitializationException;
061
062
063 /**
064 * This method indicates if the log file should be
065 * rotated or not.
066 *
067 * @param writer The multi file writer writing the file to be
068 * checked.
069 * @return true if the log file should be rotated, false otherwise.
070 */
071 public boolean rotateFile(MultifileTextWriter writer);
072
073
074 }
075