2362N/A * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * <p> Underlying security services instantiate and pass a 0N/A * <code>ConfirmationCallback</code> to the <code>handle</code> 0N/A * method of a <code>CallbackHandler</code> to ask for YES/NO, 0N/A * @see javax.security.auth.callback.CallbackHandler 0N/A * Unspecified option type. 0N/A * <p> The <code>getOptionType</code> method returns this 0N/A * value if this <code>ConfirmationCallback</code> was instantiated 0N/A * with <code>options</code> instead of an <code>optionType</code>. 0N/A * <p> An underlying security service specifies this as the 0N/A * <code>optionType</code> to a <code>ConfirmationCallback</code> 0N/A * constructor if it requires a confirmation which can be answered 0N/A * with either <code>YES</code> or <code>NO</code>. 0N/A * <p> An underlying security service specifies this as the 0N/A * <code>optionType</code> to a <code>ConfirmationCallback</code> 0N/A * constructor if it requires a confirmation which can be answered 0N/A * with either <code>YES</code>, <code>NO</code> or <code>CANCEL</code>. 0N/A * <p> An underlying security service specifies this as the 0N/A * <code>optionType</code> to a <code>ConfirmationCallback</code> 0N/A * constructor if it requires a confirmation which can be answered 0N/A * with either <code>OK</code> or <code>CANCEL</code>. 0N/A * <p> If an <code>optionType</code> was specified to this 0N/A * <code>ConfirmationCallback</code>, this option may be specified as a 0N/A * <code>defaultOption</code> or returned as the selected index. 0N/A public static final int YES =
0;
0N/A * <p> If an <code>optionType</code> was specified to this 0N/A * <code>ConfirmationCallback</code>, this option may be specified as a 0N/A * <code>defaultOption</code> or returned as the selected index. 0N/A public static final int NO =
1;
0N/A * <p> If an <code>optionType</code> was specified to this 0N/A * <code>ConfirmationCallback</code>, this option may be specified as a 0N/A * <code>defaultOption</code> or returned as the selected index. 0N/A * <p> If an <code>optionType</code> was specified to this 0N/A * <code>ConfirmationCallback</code>, this option may be specified as a 0N/A * <code>defaultOption</code> or returned as the selected index. 0N/A public static final int OK =
3;
0N/A /** INFORMATION message type. */ 0N/A /** WARNING message type. */ 0N/A /** ERROR message type. */ 0N/A * Construct a <code>ConfirmationCallback</code> with a 0N/A * message type, an option type and a default option. 0N/A * <p> Underlying security services use this constructor if 0N/A * @param messageType the message type (<code>INFORMATION</code>, 0N/A * <code>WARNING</code> or <code>ERROR</code>). <p> 0N/A * @param optionType the option type (<code>YES_NO_OPTION</code>, 0N/A * <code>YES_NO_CANCEL_OPTION</code> or 0N/A * <code>OK_CANCEL_OPTION</code>). <p> 0N/A * @param defaultOption the default option 0N/A * from the provided optionType (<code>YES</code>, 0N/A * <code>NO</code>, <code>CANCEL</code> or 0N/A * @exception IllegalArgumentException if messageType is not either 0N/A * <code>INFORMATION</code>, <code>WARNING</code>, 0N/A * or <code>ERROR</code>, if optionType is not either 0N/A * <code>YES_NO_OPTION</code>, 0N/A * <code>YES_NO_CANCEL_OPTION</code>, or 0N/A * <code>OK_CANCEL_OPTION</code>, 0N/A * or if <code>defaultOption</code> 0N/A * does not correspond to one of the options in 0N/A * <code>optionType</code>. 0N/A * Construct a <code>ConfirmationCallback</code> with a 0N/A * message type, a list of options and a default option. 0N/A * <p> Underlying security services use this constructor if 0N/A * they require a confirmation different from the available preset 0N/A * The confirmation options are listed in the <code>options</code> array, 0N/A * and are displayed by the <code>CallbackHandler</code> implementation 0N/A * in a manner consistent with the way preset options are displayed. 0N/A * @param messageType the message type (<code>INFORMATION</code>, 0N/A * <code>WARNING</code> or <code>ERROR</code>). <p> 0N/A * @param options the list of confirmation options. <p> 0N/A * @param defaultOption the default option, represented as an index 0N/A * into the <code>options</code> array. 0N/A * @exception IllegalArgumentException if messageType is not either 0N/A * <code>INFORMATION</code>, <code>WARNING</code>, 0N/A * or <code>ERROR</code>, if <code>options</code> is null, 0N/A * if <code>options</code> has a length of 0, 0N/A * if any element from <code>options</code> is null, 0N/A * if any element from <code>options</code> 0N/A * has a length of 0, or if <code>defaultOption</code> 0N/A * does not lie within the array boundaries of 0N/A * <code>options</code>. 0N/A * Construct a <code>ConfirmationCallback</code> with a prompt, 0N/A * message type, an option type and a default option. 0N/A * <p> Underlying security services use this constructor if 0N/A * @param prompt the prompt used to describe the list of options. <p> 0N/A * @param messageType the message type (<code>INFORMATION</code>, 0N/A * <code>WARNING</code> or <code>ERROR</code>). <p> 0N/A * @param optionType the option type (<code>YES_NO_OPTION</code>, 0N/A * <code>YES_NO_CANCEL_OPTION</code> or 0N/A * <code>OK_CANCEL_OPTION</code>). <p> 0N/A * @param defaultOption the default option 0N/A * from the provided optionType (<code>YES</code>, 0N/A * <code>NO</code>, <code>CANCEL</code> or 0N/A * @exception IllegalArgumentException if <code>prompt</code> is null, 0N/A * if <code>prompt</code> has a length of 0, 0N/A * if messageType is not either 0N/A * <code>INFORMATION</code>, <code>WARNING</code>, 0N/A * or <code>ERROR</code>, if optionType is not either 0N/A * <code>YES_NO_OPTION</code>, 0N/A * <code>YES_NO_CANCEL_OPTION</code>, or 0N/A * <code>OK_CANCEL_OPTION</code>, 0N/A * or if <code>defaultOption</code> 0N/A * does not correspond to one of the options in 0N/A * <code>optionType</code>. 0N/A * Construct a <code>ConfirmationCallback</code> with a prompt, 0N/A * message type, a list of options and a default option. 0N/A * <p> Underlying security services use this constructor if 0N/A * they require a confirmation different from the available preset 0N/A * The confirmation options are listed in the <code>options</code> array, 0N/A * and are displayed by the <code>CallbackHandler</code> implementation 0N/A * in a manner consistent with the way preset options are displayed. 0N/A * @param prompt the prompt used to describe the list of options. <p> 0N/A * @param messageType the message type (<code>INFORMATION</code>, 0N/A * <code>WARNING</code> or <code>ERROR</code>). <p> 0N/A * @param options the list of confirmation options. <p> 0N/A * @param defaultOption the default option, represented as an index 0N/A * into the <code>options</code> array. 0N/A * @exception IllegalArgumentException if <code>prompt</code> is null, 0N/A * if <code>prompt</code> has a length of 0, 0N/A * if messageType is not either 0N/A * <code>INFORMATION</code>, <code>WARNING</code>, 0N/A * or <code>ERROR</code>, if <code>options</code> is null, 0N/A * if <code>options</code> has a length of 0, 0N/A * if any element from <code>options</code> is null, 0N/A * if any element from <code>options</code> 0N/A * has a length of 0, or if <code>defaultOption</code> 0N/A * does not lie within the array boundaries of 0N/A * <code>options</code>. 0N/A * @return the prompt, or null if this <code>ConfirmationCallback</code> 0N/A * was instantiated without a <code>prompt</code>. 0N/A * Get the message type. 0N/A * @return the message type (<code>INFORMATION</code>, 0N/A * <code>WARNING</code> or <code>ERROR</code>). 0N/A * Get the option type. 0N/A * <p> If this method returns <code>UNSPECIFIED_OPTION</code>, then this 0N/A * <code>ConfirmationCallback</code> was instantiated with 0N/A * <code>options</code> instead of an <code>optionType</code>. 0N/A * In this case, invoke the <code>getOptions</code> method 0N/A * to determine which confirmation options to display. 0N/A * @return the option type (<code>YES_NO_OPTION</code>, 0N/A * <code>YES_NO_CANCEL_OPTION</code> or 0N/A * <code>OK_CANCEL_OPTION</code>), or 0N/A * <code>UNSPECIFIED_OPTION</code> if this 0N/A * <code>ConfirmationCallback</code> was instantiated with 0N/A * <code>options</code> instead of an <code>optionType</code>. 0N/A * Get the confirmation options. 0N/A * @return the list of confirmation options, or null if this 0N/A * <code>ConfirmationCallback</code> was instantiated with 0N/A * an <code>optionType</code> instead of <code>options</code>. 0N/A * Get the default option. 0N/A * @return the default option, represented as 0N/A * <code>YES</code>, <code>NO</code>, <code>OK</code> or 0N/A * <code>CANCEL</code> if an <code>optionType</code> 0N/A * was specified to the constructor of this 0N/A * <code>ConfirmationCallback</code>. 0N/A * Otherwise, this method returns the default option as 0N/A * <code>options</code> array specified to the constructor 0N/A * of this <code>ConfirmationCallback</code>. 0N/A * Set the selected confirmation option. 0N/A * @param selection the selection represented as <code>YES</code>, 0N/A * <code>NO</code>, <code>OK</code> or <code>CANCEL</code> 0N/A * if an <code>optionType</code> was specified to the constructor 0N/A * of this <code>ConfirmationCallback</code>. 0N/A * Otherwise, the selection represents the index into the 0N/A * <code>options</code> array specified to the constructor 0N/A * of this <code>ConfirmationCallback</code>. 0N/A * @see #getSelectedIndex 0N/A * Get the selected confirmation option. 0N/A * @return the selected confirmation option represented as 0N/A * <code>YES</code>, <code>NO</code>, <code>OK</code> or 0N/A * <code>CANCEL</code> if an <code>optionType</code> 0N/A * was specified to the constructor of this 0N/A * <code>ConfirmationCallback</code>. 0N/A * Otherwise, this method returns the selected confirmation 0N/A * option as an index into the 0N/A * <code>options</code> array specified to the constructor 0N/A * of this <code>ConfirmationCallback</code>. 0N/A * @see #setSelectedIndex