001/*
002 * Copyright 2009-2018 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2018 Ping Identity Corporation
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021package com.unboundid.ldap.sdk.unboundidds.logs;
022
023
024
025import com.unboundid.util.NotMutable;
026import com.unboundid.util.ThreadSafety;
027import com.unboundid.util.ThreadSafetyLevel;
028
029
030
031/**
032 * This class provides a data structure that holds information about a log
033 * message that may appear in the Directory Server access log about a modify
034 * request forwarded to a backend server.
035 * <BR>
036 * <BLOCKQUOTE>
037 *   <B>NOTE:</B>  This class, and other classes within the
038 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
039 *   supported for use against Ping Identity, UnboundID, and
040 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
041 *   for proprietary functionality or for external specifications that are not
042 *   considered stable or mature enough to be guaranteed to work in an
043 *   interoperable way with other types of LDAP servers.
044 * </BLOCKQUOTE>
045 */
046@NotMutable()
047@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
048public final class ModifyForwardAccessLogMessage
049       extends ModifyRequestAccessLogMessage
050{
051  /**
052   * The serial version UID for this serializable class.
053   */
054  private static final long serialVersionUID = 7933843749321013693L;
055
056
057
058  // The port of the backend server to which the request has been forwarded.
059  private final Integer targetPort;
060
061  // The address of the backend server to which the request has been forwarded.
062  private final String targetHost;
063
064  // The protocol used to forward the request to the backend server.
065  private final String targetProtocol;
066
067
068
069  /**
070   * Creates a new modify forward access log message from the provided message
071   * string.
072   *
073   * @param  s  The string to be parsed as a modify forward access log message.
074   *
075   * @throws  LogException  If the provided string cannot be parsed as a valid
076   *                        log message.
077   */
078  public ModifyForwardAccessLogMessage(final String s)
079         throws LogException
080  {
081    this(new LogMessage(s));
082  }
083
084
085
086  /**
087   * Creates a new modify forward access log message from the provided log
088   * message.
089   *
090   * @param  m  The log message to be parsed as a modify forward access log
091   *            message.
092   */
093  public ModifyForwardAccessLogMessage(final LogMessage m)
094  {
095    super(m);
096
097    targetHost     = getNamedValue("targetHost");
098    targetPort     = getNamedValueAsInteger("targetPort");
099    targetProtocol = getNamedValue("targetProtocol");
100  }
101
102
103
104  /**
105   * Retrieves the address of the backend server to which the request has been
106   * forwarded.
107   *
108   * @return  The address of the backend server to which the request has been
109   *          forwarded, or {@code null} if it is not included in the log
110   *          message.
111   */
112  public String getTargetHost()
113  {
114    return targetHost;
115  }
116
117
118
119  /**
120   * Retrieves the port of the backend server to which the request has been
121   * forwarded.
122   *
123   * @return  The port of the backend server to which the request has been
124   *          forwarded, or {@code null} if it is not included in the log
125   *          message.
126   */
127  public Integer getTargetPort()
128  {
129    return targetPort;
130  }
131
132
133
134  /**
135   * Retrieves the protocol used to forward the request to the backend server.
136   *
137   * @return  The protocol used to forward the request to the backend server, or
138   *          {@code null} if it is not included in the log message.
139   */
140  public String getTargetProtocol()
141  {
142    return targetProtocol;
143  }
144
145
146
147  /**
148   * {@inheritDoc}
149   */
150  @Override()
151  public AccessLogMessageType getMessageType()
152  {
153    return AccessLogMessageType.FORWARD;
154  }
155}