001 /* 002 * Copyright 2009-2015 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005 /* 006 * Copyright (C) 2015 UnboundID Corp. 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 */ 021 package com.unboundid.ldap.sdk.unboundidds.logs; 022 023 024 025 import com.unboundid.util.NotExtensible; 026 import com.unboundid.util.ThreadSafety; 027 import com.unboundid.util.ThreadSafetyLevel; 028 029 030 031 /** 032 * <BLOCKQUOTE> 033 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID 034 * LDAP SDK for Java. It is not available for use in applications that 035 * include only the Standard Edition of the LDAP SDK, and is not supported for 036 * use in conjunction with non-UnboundID products. 037 * </BLOCKQUOTE> 038 * This class provides a data structure that holds information about a log 039 * message that may appear in the Directory Server access log about an 040 * operation processed by the server. 041 */ 042 @NotExtensible() 043 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 044 public abstract class OperationAccessLogMessage 045 extends AccessLogMessage 046 { 047 /** 048 * The serial version UID for this serializable class. 049 */ 050 private static final long serialVersionUID = 5311424730889643655L; 051 052 053 054 // The message ID for this access log message. 055 private final Integer messageID; 056 057 // The operation ID for this access log message. 058 private final Long operationID; 059 060 // The message origin for this access log message. 061 private final String origin; 062 063 064 065 /** 066 * Creates a new operation access log message from the provided log message. 067 * 068 * @param m The log message to be parsed as an operation access log message. 069 */ 070 protected OperationAccessLogMessage(final LogMessage m) 071 { 072 super(m); 073 074 messageID = getNamedValueAsInteger("msgID"); 075 operationID = getNamedValueAsLong("op"); 076 origin = getNamedValue("origin"); 077 } 078 079 080 081 /** 082 * Retrieves the operation ID for the associated operation. 083 * 084 * @return The operation ID for the associated operation, or {@code null} if 085 * it is not included in the log message. 086 */ 087 public final Long getOperationID() 088 { 089 return operationID; 090 } 091 092 093 094 /** 095 * Retrieves the message ID for the associated operation. 096 * 097 * @return The message ID for the associated operation, or {@code null} if 098 * it is not included in the log message. 099 */ 100 public final Integer getMessageID() 101 { 102 return messageID; 103 } 104 105 106 107 /** 108 * Retrieves the origin of the associated operation. If present, it may be 109 * "synchronization" if the operation is replicated, or "internal" if it is an 110 * internal operation. 111 * 112 * @return The origin for the associated operation, or {@code null} if it is 113 * not included in the log message. 114 */ 115 public final String getOrigin() 116 { 117 return origin; 118 } 119 120 121 122 /** 123 * Retrieves the operation type for the associated operation. 124 * 125 * @return The operation type for this access log message. 126 */ 127 public abstract AccessLogOperationType getOperationType(); 128 }