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.NotExtensible;
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 an
034 * operation processed by the 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 Alcatel-Lucent 8661
040 *   server products.  These classes provide support for proprietary
041 *   functionality or for external specifications that are not considered stable
042 *   or mature enough to be guaranteed to work in an interoperable way with
043 *   other types of LDAP servers.
044 * </BLOCKQUOTE>
045 */
046@NotExtensible()
047@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
048public abstract class OperationAccessLogMessage
049       extends AccessLogMessage
050{
051  /**
052   * The serial version UID for this serializable class.
053   */
054  private static final long serialVersionUID = 5311424730889643655L;
055
056
057
058  // The message ID for this access log message.
059  private final Integer messageID;
060
061  // The operation ID for this access log message.
062  private final Long operationID;
063
064  // The connection ID for the operation that triggered the associated
065  // operation.
066  private final Long triggeredByConnectionID;
067
068  // The operation ID for the operation that triggered the associated operation.
069  private final Long triggeredByOperationID;
070
071  // The message origin for this access log message.
072  private final String origin;
073
074
075
076  /**
077   * Creates a new operation access log message from the provided log message.
078   *
079   * @param  m  The log message to be parsed as an operation access log message.
080   */
081  protected OperationAccessLogMessage(final LogMessage m)
082  {
083    super(m);
084
085    messageID               = getNamedValueAsInteger("msgID");
086    operationID             = getNamedValueAsLong("op");
087    triggeredByConnectionID = getNamedValueAsLong("triggeredByConn");
088    triggeredByOperationID  = getNamedValueAsLong("triggeredByOp");
089    origin                  = getNamedValue("origin");
090  }
091
092
093
094  /**
095   * Retrieves the operation ID for the associated operation.
096   *
097   * @return  The operation ID for the associated operation, or {@code null} if
098   *          it is not included in the log message.
099   */
100  public final Long getOperationID()
101  {
102    return operationID;
103  }
104
105
106
107  /**
108   * Retrieves the connection ID for the connection that triggered the
109   * associated operation.  This is generally used for internal operations that
110   * are processed as a direct result of an externally-requested operation.
111   *
112   * @return  The connection ID for the connection that triggered the associated
113   *          operation, or {@code null} if it is not included in the log
114   *          message.
115   */
116  public final Long getTriggeredByConnectionID()
117  {
118    return triggeredByConnectionID;
119  }
120
121
122
123  /**
124   * Retrieves the operation ID for the operation that triggered the associated
125   * operation.  This is generally used for internal operations that are
126   * processed as a direct result of an externally-requested operation.
127   *
128   * @return  The operation ID for the operation that triggered the associated
129   *          operation, or {@code null} if it is not included in the log
130   *          message.
131   */
132  public final Long getTriggeredByOperationID()
133  {
134    return triggeredByOperationID;
135  }
136
137
138
139  /**
140   * Retrieves the message ID for the associated operation.
141   *
142   * @return  The message ID for the associated operation, or {@code null} if
143   *          it is not included in the log message.
144   */
145  public final Integer getMessageID()
146  {
147    return messageID;
148  }
149
150
151
152  /**
153   * Retrieves the origin of the associated operation.  If present, it may be
154   * "synchronization" if the operation is replicated, or "internal" if it is an
155   * internal operation.
156   *
157   * @return  The origin for the associated operation, or {@code null} if it is
158   *          not included in the log message.
159   */
160  public final String getOrigin()
161  {
162    return origin;
163  }
164
165
166
167  /**
168   * Retrieves the operation type for the associated operation.
169   *
170   * @return  The operation type for this access log message.
171   */
172  public abstract AccessLogOperationType getOperationType();
173}