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 */
026package org.forgerock.opendj.config.server;
027
028import org.forgerock.i18n.LocalizableException;
029import org.forgerock.i18n.LocalizableMessage;
030
031/**
032 * Thrown during the course of interactions with the Directory Server
033 * configuration.
034 */
035public final class ConfigException extends Exception implements LocalizableException {
036    private static final long serialVersionUID = -540463620272921157L;
037    private final LocalizableMessage message;
038
039    /**
040     * Returns the message that explains the problem that occurred.
041     *
042     * @return LocalizableMessage of the problem
043     */
044    public LocalizableMessage getMessageObject() {
045        return message;
046    }
047
048    /**
049     * Creates a new configuration exception with the provided message.
050     *
051     * @param message
052     *            The message to use for this configuration exception.
053     */
054    public ConfigException(LocalizableMessage message) {
055        super(message.toString());
056        this.message = message;
057    }
058
059    /**
060     * Creates a new configuration exception with the provided message and
061     * underlying cause.
062     *
063     * @param message
064     *            The message to use for this configuration exception.
065     * @param cause
066     *            The underlying cause that triggered this configuration
067     *            exception.
068     */
069    public ConfigException(LocalizableMessage message, Throwable cause) {
070        super(message.toString(), cause);
071        this.message = message;
072    }
073
074}