001/*
002 * Copyright 2014-2017 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2017 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.controls;
022
023
024
025import com.unboundid.util.ThreadSafety;
026import com.unboundid.util.ThreadSafetyLevel;
027
028
029
030/**
031 * This enum defines the set of routing types that may be used in a route to
032 * backend set request control.
033 * <BR>
034 * <BLOCKQUOTE>
035 *   <B>NOTE:</B>  This class, and other classes within the
036 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
037 *   supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661
038 *   server products.  These classes provide support for proprietary
039 *   functionality or for external specifications that are not considered stable
040 *   or mature enough to be guaranteed to work in an interoperable way with
041 *   other types of LDAP servers.
042 * </BLOCKQUOTE>
043 */
044@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
045public enum RouteToBackendSetRoutingType
046{
047  /**
048   * The routing type that is used for a control which specifies the absolute
049   * collection of backend sets to which the request should be forwarded.
050   */
051  ABSOLUTE_ROUTING((byte) 0xA0),
052
053
054
055  /**
056   * The routing type that is used for a control which specifies a routing
057   * hint to use as a first guess for processing the request and an optional
058   * collection of fallback sets.
059   */
060  ROUTING_HINT((byte) 0xA1);
061
062
063
064  // The BER type that corresponds to this enum value.
065  private final byte berType;
066
067
068
069  /**
070   * Creates a new route to backend set routing type value with the provided
071   * information.
072   *
073   * @param  berType  The BER type that corresponds to this enum value.
074   */
075  RouteToBackendSetRoutingType(final byte berType)
076  {
077    this.berType = berType;
078  }
079
080
081
082  /**
083   * Retrieves the BER type for this routing type value.
084   *
085   * @return  The BER type for this routing type value.
086   */
087  public byte getBERType()
088  {
089    return berType;
090  }
091
092
093
094  /**
095   * Retrieves the routing type value for the provided BER type.
096   *
097   * @param  berType  The BER type for the routing type value to retrieve.
098   *
099   * @return  The routing type value that corresponds to the provided BER type,
100   *          or {@code null} if there is no corresponding routing type value.
101   */
102  public static RouteToBackendSetRoutingType valueOf(final byte berType)
103  {
104    for (final RouteToBackendSetRoutingType t : values())
105    {
106      if (t.berType == berType)
107      {
108        return t;
109      }
110    }
111
112    return null;
113  }
114}