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 2008 Sun Microsystems, Inc.
015 * Portions Copyright 2014 ForgeRock AS.
016 */
017
018package org.opends.server.admin.client;
019
020
021
022import static org.opends.messages.AdminMessages.*;
023
024import org.forgerock.i18n.LocalizableMessage;
025
026
027
028/**
029 * This exception is thrown when a communications related problem
030 * occurs whilst interacting with the Directory Server. This may be
031 * caused by problems such as network partitioning, the unavailability
032 * of the Directory Server, or other failures on the client or server
033 * side.
034 */
035public class CommunicationException extends AdminClientException {
036
037  /**
038   * Serialization ID.
039   */
040  private static final long serialVersionUID = 9093195928501281027L;
041
042
043
044  /**
045   * Create a communication exception with a default message.
046   */
047  public CommunicationException() {
048    super(ERR_COMMUNICATION_EXCEPTION_DEFAULT.get());
049  }
050
051
052
053  /**
054   * Create a communication exception with a cause and a default
055   * message.
056   *
057   * @param cause
058   *          The cause.
059   */
060  public CommunicationException(Throwable cause) {
061    super(ERR_COMMUNICATION_EXCEPTION_DEFAULT_CAUSE.get(cause.getMessage()),
062        cause);
063  }
064
065
066
067  /**
068   * Create a communication exception with a message and cause.
069   *
070   * @param message
071   *          The message.
072   * @param cause
073   *          The cause.
074   */
075  public CommunicationException(LocalizableMessage message, Throwable cause) {
076    super(message, cause);
077  }
078
079
080
081  /**
082   * Create a communication exception with a message.
083   *
084   * @param message
085   *          The message.
086   */
087  public CommunicationException(LocalizableMessage message) {
088    super(message);
089  }
090}