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 *      Portions Copyright 2013-2014 ForgeRock AS.
025 */
026package org.opends.server.loggers;
027
028import java.util.List;
029
030import org.forgerock.i18n.LocalizableMessage;
031import org.opends.server.admin.std.server.HTTPAccessLogPublisherCfg;
032
033/**
034 * This class defines the set of methods and structures that must be implemented
035 * for a Directory Server HTTP access log publisher.
036 *
037 * @param <T>
038 *          The type of HTTP access log publisher configuration handled by this
039 *          log publisher implementation.
040 */
041@org.opends.server.types.PublicAPI(
042    stability = org.opends.server.types.StabilityLevel.VOLATILE,
043    mayInstantiate = false,
044    mayExtend = true,
045    mayInvoke = false)
046public abstract class HTTPAccessLogPublisher
047    <T extends HTTPAccessLogPublisherCfg> implements LogPublisher<T>
048{
049
050  /** {@inheritDoc} */
051  @Override
052  public boolean isConfigurationAcceptable(T configuration,
053      List<LocalizableMessage> unacceptableReasons)
054  {
055    // This default implementation does not perform any special
056    // validation. It should be overridden by HTTP access log publisher
057    // implementations that wish to perform more detailed validation.
058    return true;
059  }
060
061  /**
062   * Logs the request info according to the configured extended log format.
063   *
064   * @param requestInfo
065   *          The request info to log
066   * @see <a href="http://www.w3.org/TR/WD-logfile.html">W3C's Extended Log File
067   *      Format</a>
068   * @see <a href=
069   *      "http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/
070   *      Library/IIS/676400bc-8969-4aa7-851a-9319490a9bbb.mspx?mfr=true">
071   *      Microsoft's W3C Extended Log File Format (IIS 6.0)</a>
072   */
073  public void logRequestInfo(HTTPRequestInfo requestInfo)
074  {
075    // Do nothing
076  }
077
078}