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.NotMutable;
027    import com.unboundid.util.ThreadSafety;
028    import com.unboundid.util.ThreadSafetyLevel;
029    
030    
031    
032    /**
033     * <BLOCKQUOTE>
034     *   <B>NOTE:</B>  This class is part of the Commercial Edition of the UnboundID
035     *   LDAP SDK for Java.  It is not available for use in applications that
036     *   include only the Standard Edition of the LDAP SDK, and is not supported for
037     *   use in conjunction with non-UnboundID products.
038     * </BLOCKQUOTE>
039     * This class provides a data structure that holds information about a log
040     * message that may appear in the Directory Server access log about a delete
041     * request received from a client.
042     */
043    @NotExtensible()
044    @NotMutable()
045    @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
046    public class DeleteRequestAccessLogMessage
047           extends OperationRequestAccessLogMessage
048    {
049      /**
050       * The serial version UID for this serializable class.
051       */
052      private static final long serialVersionUID = 4562376555035497481L;
053    
054    
055    
056      // The DN of the entry to delete.
057      private final String dn;
058    
059    
060    
061      /**
062       * Creates a new delete request access log message from the provided message
063       * string.
064       *
065       * @param  s  The string to be parsed as a delete request access log message.
066       *
067       * @throws  LogException  If the provided string cannot be parsed as a valid
068       *                        log message.
069       */
070      public DeleteRequestAccessLogMessage(final String s)
071             throws LogException
072      {
073        this(new LogMessage(s));
074      }
075    
076    
077    
078      /**
079       * Creates a new delete request access log message from the provided log
080       * message.
081       *
082       * @param  m  The log message to be parsed as a delete request access log
083       *            message.
084       */
085      public DeleteRequestAccessLogMessage(final LogMessage m)
086      {
087        super(m);
088    
089        dn = getNamedValue("dn");
090      }
091    
092    
093    
094      /**
095       * Retrieves the DN of the entry to delete.
096       *
097       * @return  The DN of the entry to delete, or {@code null} if it is not
098       *          included in the log message.
099       */
100      public final String getDN()
101      {
102        return dn;
103      }
104    
105    
106    
107      /**
108       * {@inheritDoc}
109       */
110      @Override()
111      public final AccessLogOperationType getOperationType()
112      {
113        return AccessLogOperationType.DELETE;
114      }
115    }