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 DN
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 ModifyDNForwardAccessLogMessage
049       extends ModifyDNRequestAccessLogMessage
050{
051  /**
052   * The serial version UID for this serializable class.
053   */
054  private static final long serialVersionUID = 5467149735852324336L;
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 DN forward access log message from the provided
071   * message string.
072   *
073   * @param  s  The string to be parsed as a modify DN forward access log
074   *            message.
075   *
076   * @throws  LogException  If the provided string cannot be parsed as a valid
077   *                        log message.
078   */
079  public ModifyDNForwardAccessLogMessage(final String s)
080         throws LogException
081  {
082    this(new LogMessage(s));
083  }
084
085
086
087  /**
088   * Creates a new modify DN forward access log message from the provided log
089   * message.
090   *
091   * @param  m  The log message to be parsed as a modify DN forward access log
092   *            message.
093   */
094  public ModifyDNForwardAccessLogMessage(final LogMessage m)
095  {
096    super(m);
097
098    targetHost     = getNamedValue("targetHost");
099    targetPort     = getNamedValueAsInteger("targetPort");
100    targetProtocol = getNamedValue("targetProtocol");
101  }
102
103
104
105  /**
106   * Retrieves the address of the backend server to which the request has been
107   * forwarded.
108   *
109   * @return  The address of the backend server to which the request has been
110   *          forwarded, or {@code null} if it is not included in the log
111   *          message.
112   */
113  public String getTargetHost()
114  {
115    return targetHost;
116  }
117
118
119
120  /**
121   * Retrieves the port of the backend server to which the request has been
122   * forwarded.
123   *
124   * @return  The port of the backend server to which the request has been
125   *          forwarded, or {@code null} if it is not included in the log
126   *          message.
127   */
128  public Integer getTargetPort()
129  {
130    return targetPort;
131  }
132
133
134
135  /**
136   * Retrieves the protocol used to forward the request to the backend server.
137   *
138   * @return  The protocol used to forward the request to the backend server, or
139   *          {@code null} if it is not included in the log message.
140   */
141  public String getTargetProtocol()
142  {
143    return targetProtocol;
144  }
145
146
147
148  /**
149   * {@inheritDoc}
150   */
151  @Override()
152  public AccessLogMessageType getMessageType()
153  {
154    return AccessLogMessageType.FORWARD;
155  }
156}