001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2015 ForgeRock AS.
016 */
017package org.opends.server.types;
018
019
020
021/**
022 * This enumeration defines a set of lock types that can be used when
023 * requesting that a lock be obtained for an entry or some other
024 * object.
025 */
026@org.opends.server.types.PublicAPI(
027     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
028     mayInstantiate=false,
029     mayExtend=false,
030     mayInvoke=true)
031public enum LockType
032{
033  /**
034   * The lock type that indicates that a read lock should be obtained
035   * for the associated object.
036   */
037  READ("Read"),
038
039
040
041  /**
042   * The lock type that indicates that a write lock should be obtained
043   * for the associated object.
044   */
045  WRITE("Write"),
046
047
048
049  /**
050   * The lock type that indicates that no lock should be obtained for
051   * the associated object.
052   */
053  NONE("None");
054
055
056
057  /** The human-readable name for this lock type. */
058  private String name;
059
060
061
062  /**
063   * Creates a new lock type element with the provided name.
064   *
065   * @param  name  The name of the lock type element to create.
066   */
067  private LockType(String name)
068  {
069    this.name = name;
070  }
071
072
073
074  /**
075   * Retrieves the name of this lock type element.
076   *
077   * @return  The name of this lock type element.
078   */
079  public String getName()
080  {
081    return name;
082  }
083
084
085
086  /**
087   * Retrieves a string representation of this lock type element.
088   *
089   * @return  A string representation of this lock type element.
090   */
091  public String toString()
092  {
093    return name;
094  }
095}
096