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 *      Portions Copyright 2013-2014 ForgeRock AS
025 */
026package org.opends.server.tools.upgrade;
027
028import javax.security.auth.callback.TextOutputCallback;
029
030import org.forgerock.i18n.LocalizableMessage;
031
032/**
033 * A formatted notification callback for display title and more...
034 */
035public class FormattedNotificationCallback extends TextOutputCallback
036{
037  /**
038   * Serial version UID.
039   */
040  private static final long serialVersionUID = 1L;
041
042  /** Output a title. */
043  public static final int TITLE_CALLBACK = 5;
044
045  /** Output a sub-title. */
046  public static final int SUBTITLE_CALLBACK = 6;
047
048  /** Output a notice message. */
049  public static final int NOTICE_CALLBACK = 7;
050
051  /** Output an error. */
052  public static final int ERROR_CALLBACK = 8;
053
054  /**
055   * An integer representing the message's sub-type.
056   */
057  private int messageSubType;
058
059  /**
060   * A progress notification constructor.
061   *
062   * @param message
063   *          The message to display
064   * @param messageSubType
065   *          An integer representing the sub-type of this message.
066   */
067  FormattedNotificationCallback(final LocalizableMessage message,
068      final int messageSubType)
069  {
070    super(TextOutputCallback.INFORMATION, message.toString());
071    this.messageSubType = messageSubType;
072  }
073
074  /**
075   * Returns an integer which represents the message's sub-type.
076   *
077   * @return An integer which represents the message's sub-type.
078   */
079  public int getMessageSubType()
080  {
081    return messageSubType;
082  }
083}