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.ThreadSafety;
026    import com.unboundid.util.ThreadSafetyLevel;
027    
028    
029    
030    /**
031     * <BLOCKQUOTE>
032     *   <B>NOTE:</B>  This class is part of the Commercial Edition of the UnboundID
033     *   LDAP SDK for Java.  It is not available for use in applications that
034     *   include only the Standard Edition of the LDAP SDK, and is not supported for
035     *   use in conjunction with non-UnboundID products.
036     * </BLOCKQUOTE>
037     * This enum defines the set of access log operation types.
038     */
039    @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
040    public enum AccessLogOperationType
041    {
042      /**
043       * The operation type that will be used for messages about abandon operations.
044       */
045      ABANDON("ABANDON"),
046    
047    
048    
049      /**
050       * The operation type that will be used for messages about add operations.
051       */
052      ADD("ADD"),
053    
054    
055    
056      /**
057       * The operation type that will be used for messages about bind operations.
058       */
059      BIND("BIND"),
060    
061    
062    
063      /**
064       * The operation type that will be used for messages about compare operations.
065       */
066      COMPARE("COMPARE"),
067    
068    
069    
070      /**
071       * The operation type that will be used for messages about delete operations.
072       */
073      DELETE("DELETE"),
074    
075    
076    
077      /**
078       * The operation type that will be used for messages about extended
079       * operations.
080       */
081      EXTENDED("EXTENDED"),
082    
083    
084    
085      /**
086       * The operation type that will be used for messages about modify operations.
087       */
088      MODIFY("MODIFY"),
089    
090    
091    
092      /**
093       * The operation type that will be used for messages about modify DN
094       * operations.
095       */
096      MODDN("MODDN"),
097    
098    
099    
100      /**
101       * The operation type that will be used for messages about search operations.
102       */
103      SEARCH("SEARCH"),
104    
105    
106    
107      /**
108       * The operation type that will be used for messages about unbind operations.
109       */
110      UNBIND("UNBIND");
111    
112    
113    
114      // The string that will be used to identify this message type in log files.
115      private final String logIdentifier;
116    
117    
118    
119      /**
120       * Creates a new access log operation type with the provided information.
121       *
122       * @param  logIdentifier  The string that will be used to identify this
123       *                        operation type in log files.
124       */
125      private AccessLogOperationType(final String logIdentifier)
126      {
127        this.logIdentifier = logIdentifier;
128      }
129    
130    
131    
132      /**
133       * Retrieves the string that will be used to identify this operation type in
134       * log files.
135       *
136       * @return  The string that will be used to identify this operation type in
137       *          log files.
138       */
139      public String getLogIdentifier()
140      {
141        return logIdentifier;
142      }
143    
144    
145    
146      /**
147       * Retrieves the access log operation type with the provided identifier.
148       *
149       * @param  logIdentifier  The identifier string for which to retrieve the
150       *                        corresponding access log operation type.
151       *
152       * @return  The appropriate operation type, or {@code null} if there is no
153       *          operation type associated with the provided identifier.
154       */
155      public static AccessLogOperationType forName(final String logIdentifier)
156      {
157        for (final AccessLogOperationType t : values())
158        {
159          if (t.getLogIdentifier().equals(logIdentifier))
160          {
161            return t;
162          }
163        }
164    
165        return null;
166      }
167    }