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 2014 ForgeRock AS.
016 */
017package org.opends.server.types;
018
019import org.forgerock.i18n.LocalizableMessage;
020
021
022/**
023 * This class defines an exception that may be thrown if a problem
024 * occurs while attempting to iterate across the members of a group.
025 */
026@org.opends.server.types.PublicAPI(
027     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
028     mayInstantiate=true,
029     mayExtend=false,
030     mayInvoke=true)
031public final class MembershipException
032       extends IdentifiedException
033{
034  /**
035   * The serial version identifier required to satisfy the compiler
036   * because this class extends <CODE>java.lang.Exception</CODE>,
037   * which implements the <CODE>java.io.Serializable</CODE> interface.
038   * This value was generated using the <CODE>serialver</CODE>
039   * command-line utility included with the Java SDK.
040   */
041  private static final long serialVersionUID = -7312072056288770065L;
042
043
044
045  /**
046   * Indicates whether it is possible to continue iterating through
047   * the list of group members.
048   */
049  private final boolean continueIterating;
050
051
052
053
054
055  /**
056   * Creates a new membership exception with the provided information.
057   *
058   * @param  errorMessage       The error message for this membership
059   *                            exception.
060   * @param  continueIterating  Indicates whether it is possible to
061   *                            continue iterating through the list of
062   *                            group members.
063   */
064  public MembershipException(LocalizableMessage errorMessage,
065                             boolean continueIterating)
066  {
067    super(errorMessage);
068
069    this.continueIterating = continueIterating;
070  }
071
072
073
074  /**
075   * Creates a new membership exception with the provided information.
076   *
077   * @param  errorMessage       The error message for this membership
078   *                            exception.
079   * @param  continueIterating  Indicates whether it is possible to
080   *                            continue iterating through the list of
081   *                            group members.
082   * @param  cause              The underlying cause for this
083   *                            membership exception.
084   */
085  public MembershipException(LocalizableMessage errorMessage,
086                             boolean continueIterating,
087                             Throwable cause)
088  {
089    super(errorMessage, cause);
090
091
092    this.continueIterating = continueIterating;
093  }
094
095
096
097  /**
098   * Retrieves the error message for this membership exception.
099   *
100   * @return  The error message for this membership exception.
101   */
102  public LocalizableMessage getErrorMessage()
103  {
104    return getMessageObject();
105  }
106
107
108
109  /**
110   * Indicates whether it is possible to continue iterating through
111   * the list of group members.
112   *
113   * @return  {@code true} if it is possible to continue iterating
114   *          through the list of group members, or {@code false} if
115   *          not.
116   */
117  public boolean continueIterating()
118  {
119    return continueIterating;
120  }
121}
122