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