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