001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2006-2008 Sun Microsystems, Inc.
025 *      Portions Copyright 2014 ForgeRock AS
026 */
027package org.opends.server.types;
028
029import org.forgerock.i18n.LocalizableMessage;
030
031
032/**
033 * This class defines an exception that may be thrown if a problem
034 * occurs while attempting to iterate across the members of a group.
035 */
036@org.opends.server.types.PublicAPI(
037     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
038     mayInstantiate=true,
039     mayExtend=false,
040     mayInvoke=true)
041public final class MembershipException
042       extends IdentifiedException
043{
044  /**
045   * The serial version identifier required to satisfy the compiler
046   * because this class extends <CODE>java.lang.Exception</CODE>,
047   * which implements the <CODE>java.io.Serializable</CODE> interface.
048   * This value was generated using the <CODE>serialver</CODE>
049   * command-line utility included with the Java SDK.
050   */
051  private static final long serialVersionUID = -7312072056288770065L;
052
053
054
055  /**
056   * Indicates whether it is possible to continue iterating through
057   * the list of group members.
058   */
059  private final boolean continueIterating;
060
061
062
063
064
065  /**
066   * Creates a new membership exception with the provided information.
067   *
068   * @param  errorMessage       The error message for this membership
069   *                            exception.
070   * @param  continueIterating  Indicates whether it is possible to
071   *                            continue iterating through the list of
072   *                            group members.
073   */
074  public MembershipException(LocalizableMessage errorMessage,
075                             boolean continueIterating)
076  {
077    super(errorMessage);
078
079    this.continueIterating = continueIterating;
080  }
081
082
083
084  /**
085   * Creates a new membership exception with the provided information.
086   *
087   * @param  errorMessage       The error message for this membership
088   *                            exception.
089   * @param  continueIterating  Indicates whether it is possible to
090   *                            continue iterating through the list of
091   *                            group members.
092   * @param  cause              The underlying cause for this
093   *                            membership exception.
094   */
095  public MembershipException(LocalizableMessage errorMessage,
096                             boolean continueIterating,
097                             Throwable cause)
098  {
099    super(errorMessage, cause);
100
101
102    this.continueIterating = continueIterating;
103  }
104
105
106
107  /**
108   * Retrieves the error message for this membership exception.
109   *
110   * @return  The error message for this membership exception.
111   */
112  public LocalizableMessage getErrorMessage()
113  {
114    return getMessageObject();
115  }
116
117
118
119  /**
120   * Indicates whether it is possible to continue iterating through
121   * the list of group members.
122   *
123   * @return  {@code true} if it is possible to continue iterating
124   *          through the list of group members, or {@code false} if
125   *          not.
126   */
127  public boolean continueIterating()
128  {
129    return continueIterating;
130  }
131}
132