001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Portions Copyright 2013-2016 ForgeRock AS.
015 */
016package org.opends.server.loggers;
017
018import java.util.List;
019
020import org.forgerock.i18n.LocalizableMessage;
021import org.forgerock.opendj.server.config.server.HTTPAccessLogPublisherCfg;
022
023/**
024 * This class defines the set of methods and structures that must be implemented
025 * for a Directory Server HTTP access log publisher.
026 *
027 * @param <T>
028 *          The type of HTTP access log publisher configuration handled by this
029 *          log publisher implementation.
030 */
031@org.opends.server.types.PublicAPI(
032    stability = org.opends.server.types.StabilityLevel.VOLATILE,
033    mayInstantiate = false,
034    mayExtend = true,
035    mayInvoke = false)
036public abstract class HTTPAccessLogPublisher
037    <T extends HTTPAccessLogPublisherCfg> implements LogPublisher<T>
038{
039
040  @Override
041  public boolean isConfigurationAcceptable(T configuration,
042      List<LocalizableMessage> unacceptableReasons)
043  {
044    // This default implementation does not perform any special
045    // validation. It should be overridden by HTTP access log publisher
046    // implementations that wish to perform more detailed validation.
047    return true;
048  }
049
050  /**
051   * Logs the request info according to the configured extended log format.
052   *
053   * @param requestInfo
054   *          The request info to log
055   * @see <a href="http://www.w3.org/TR/WD-logfile.html">W3C's Extended Log File
056   *      Format</a>
057   * @see <a href=
058   *      "http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/
059   *      Library/IIS/676400bc-8969-4aa7-851a-9319490a9bbb.mspx?mfr=true">
060   *      Microsoft's W3C Extended Log File Format (IIS 6.0)</a>
061   */
062  public void logRequestInfo(HTTPRequestInfo requestInfo)
063  {
064    // Do nothing
065  }
066
067}