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 delete
034 * request that was forwarded to a backend server but did not complete
035 * successfully.
036 * <BR>
037 * <BLOCKQUOTE>
038 *   <B>NOTE:</B>  This class, and other classes within the
039 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
040 *   supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661
041 *   server products.  These classes provide support for proprietary
042 *   functionality or for external specifications that are not considered stable
043 *   or mature enough to be guaranteed to work in an interoperable way with
044 *   other types of LDAP servers.
045 * </BLOCKQUOTE>
046 */
047@NotMutable()
048@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
049public final class DeleteForwardFailedAccessLogMessage
050       extends DeleteRequestAccessLogMessage
051{
052  /**
053   * The serial version UID for this serializable class.
054   */
055  private static final long serialVersionUID = -5888599636618149242L;
056
057
058
059  // The numeric result code for the failure.
060  private final Integer resultCode;
061
062  // The port of the backend server to which the request has been forwarded.
063  private final Integer targetPort;
064
065  // The diagnostic message for the failure.
066  private final String message;
067
068  // The address of the backend server to which the request has been forwarded.
069  private final String targetHost;
070
071  // The protocol used to forward the request to the backend server.
072  private final String targetProtocol;
073
074
075
076  /**
077   * Creates a new delete forward failed access log message from the provided
078   * message string.
079   *
080   * @param  s  The string to be parsed as a delete forward failed access log
081   *            message.
082   *
083   * @throws  LogException  If the provided string cannot be parsed as a valid
084   *                        log message.
085   */
086  public DeleteForwardFailedAccessLogMessage(final String s)
087         throws LogException
088  {
089    this(new LogMessage(s));
090  }
091
092
093
094  /**
095   * Creates a new delete forward failed access log message from the provided
096   * log message.
097   *
098   * @param  m  The log message to be parsed as a delete forward failed access
099   *            log message.
100   */
101  public DeleteForwardFailedAccessLogMessage(final LogMessage m)
102  {
103    super(m);
104
105    targetHost     = getNamedValue("targetHost");
106    targetPort     = getNamedValueAsInteger("targetPort");
107    targetProtocol = getNamedValue("targetProtocol");
108    resultCode     = getNamedValueAsInteger("resultCode");
109    message        = getNamedValue("message");
110  }
111
112
113
114  /**
115   * Retrieves the address of the backend server to which the request has been
116   * forwarded.
117   *
118   * @return  The address of the backend server to which the request has been
119   *          forwarded, or {@code null} if it is not included in the log
120   *          message.
121   */
122  public String getTargetHost()
123  {
124    return targetHost;
125  }
126
127
128
129  /**
130   * Retrieves the port of the backend server to which the request has been
131   * forwarded.
132   *
133   * @return  The port of the backend server to which the request has been
134   *          forwarded, or {@code null} if it is not included in the log
135   *          message.
136   */
137  public Integer getTargetPort()
138  {
139    return targetPort;
140  }
141
142
143
144  /**
145   * Retrieves the protocol used to forward the request to the backend server.
146   *
147   * @return  The protocol used to forward the request to the backend server, or
148   *          {@code null} if it is not included in the log message.
149   */
150  public String getTargetProtocol()
151  {
152    return targetProtocol;
153  }
154
155
156
157  /**
158   * Retrieves the result code received for the forwarded operation.
159   *
160   * @return  The result code received for the forwarded operation, or
161   *          {@code null} if it is not included in the log message.
162   */
163  public Integer getResultCode()
164  {
165    return resultCode;
166  }
167
168
169
170  /**
171   * Retrieves the diagnostic message received for the forwarded operation.
172   *
173   * @return  The diagnostic message received for the forwarded operation, or
174   *          {@code null} if it is not included in the log message.
175   */
176  public String getDiagnosticMessage()
177  {
178    return message;
179  }
180
181
182
183  /**
184   * {@inheritDoc}
185   */
186  @Override()
187  public AccessLogMessageType getMessageType()
188  {
189    return AccessLogMessageType.FORWARD_FAILED;
190  }
191}