001/*
002 * Copyright 2009-2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2009-2024 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2009-2024 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk.unboundidds.logs;
037
038
039
040import com.unboundid.util.NotMutable;
041import com.unboundid.util.NotNull;
042import com.unboundid.util.Nullable;
043import com.unboundid.util.ThreadSafety;
044import com.unboundid.util.ThreadSafetyLevel;
045
046
047
048/**
049 * This class provides a data structure that holds information about a log
050 * message that may appear in the Directory Server access log about a modify DN
051 * request that was forwarded to a backend server but did not complete
052 * successfully.
053 * <BR>
054 * <BLOCKQUOTE>
055 *   <B>NOTE:</B>  This class, and other classes within the
056 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
057 *   supported for use against Ping Identity, UnboundID, and
058 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
059 *   for proprietary functionality or for external specifications that are not
060 *   considered stable or mature enough to be guaranteed to work in an
061 *   interoperable way with other types of LDAP servers.
062 * </BLOCKQUOTE>
063 */
064@NotMutable()
065@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
066public final class ModifyDNForwardFailedAccessLogMessage
067       extends ModifyDNRequestAccessLogMessage
068{
069  /**
070   * The serial version UID for this serializable class.
071   */
072  private static final long serialVersionUID = 3266864464529430335L;
073
074
075
076  // The numeric result code for the failure.
077  @Nullable private final Integer resultCode;
078
079  // The port of the backend server to which the request has been forwarded.
080  @Nullable private final Integer targetPort;
081
082  // The diagnostic message for the failure.
083  @Nullable private final String message;
084
085  // The address of the backend server to which the request has been forwarded.
086  @Nullable private final String targetHost;
087
088  // The protocol used to forward the request to the backend server.
089  @Nullable private final String targetProtocol;
090
091
092
093  /**
094   * Creates a new modify DN forward failed access log message from the provided
095   * message string.
096   *
097   * @param  s  The string to be parsed as a modify DN forward failed access log
098   *            message.
099   *
100   * @throws  LogException  If the provided string cannot be parsed as a valid
101   *                        log message.
102   */
103  public ModifyDNForwardFailedAccessLogMessage(@NotNull final String s)
104         throws LogException
105  {
106    this(new LogMessage(s));
107  }
108
109
110
111  /**
112   * Creates a new modify DN forward failed access log message from the provided
113   * log message.
114   *
115   * @param  m  The log message to be parsed as a modify DN forward failed
116   *            access log message.
117   */
118  public ModifyDNForwardFailedAccessLogMessage(@NotNull final LogMessage m)
119  {
120    super(m);
121
122    targetHost     = getNamedValue("targetHost");
123    targetPort     = getNamedValueAsInteger("targetPort");
124    targetProtocol = getNamedValue("targetProtocol");
125    resultCode     = getNamedValueAsInteger("resultCode");
126    message        = getNamedValue("message");
127  }
128
129
130
131  /**
132   * Retrieves the address of the backend server to which the request has been
133   * forwarded.
134   *
135   * @return  The address of the backend server to which the request has been
136   *          forwarded, or {@code null} if it is not included in the log
137   *          message.
138   */
139  @Nullable()
140  public String getTargetHost()
141  {
142    return targetHost;
143  }
144
145
146
147  /**
148   * Retrieves the port of the backend server to which the request has been
149   * forwarded.
150   *
151   * @return  The port of the backend server to which the request has been
152   *          forwarded, or {@code null} if it is not included in the log
153   *          message.
154   */
155  @Nullable()
156  public Integer getTargetPort()
157  {
158    return targetPort;
159  }
160
161
162
163  /**
164   * Retrieves the protocol used to forward the request to the backend server.
165   *
166   * @return  The protocol used to forward the request to the backend server, or
167   *          {@code null} if it is not included in the log message.
168   */
169  @Nullable()
170  public String getTargetProtocol()
171  {
172    return targetProtocol;
173  }
174
175
176
177  /**
178   * Retrieves the result code received for the forwarded operation.
179   *
180   * @return  The result code received for the forwarded operation, or
181   *          {@code null} if it is not included in the log message.
182   */
183  @Nullable()
184  public Integer getResultCode()
185  {
186    return resultCode;
187  }
188
189
190
191  /**
192   * Retrieves the diagnostic message received for the forwarded operation.
193   *
194   * @return  The diagnostic message received for the forwarded operation, or
195   *          {@code null} if it is not included in the log message.
196   */
197  @Nullable()
198  public String getDiagnosticMessage()
199  {
200    return message;
201  }
202
203
204
205  /**
206   * {@inheritDoc}
207   */
208  @Override()
209  @NotNull()
210  public AccessLogMessageType getMessageType()
211  {
212    return AccessLogMessageType.FORWARD_FAILED;
213  }
214}