Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.security.auth.callback.ConfirmationCallback
ConfirmationCallback
to the handle()
method of a
CallbackHandler
to ask for YES/NO, OK/CANCEL, YES/NO/CANCEL or other
similar confirmations.
CallbackHandler
, Serialized FormField Summary | |
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
Constructor Summary | |
| |
| |
| |
|
Method Summary | |
int |
|
int |
|
int |
|
String[] |
|
String |
|
int |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static final int CANCEL
CANCEL option.If an
optionType
was specified to thisConfirmationCallback
, this option may be specified as adefaultOption
or returned as the selected index.
- Field Value:
- 2
public static final int NO
NO option.If an
optionType
was specified to thisConfirmationCallback
, this option may be specified as adefaultOption
or returned as the selected index.
- Field Value:
- 1
public static final int OK
OK option.If an
optionType
was specified to thisConfirmationCallback
, this option may be specified as adefaultOption
or returned as the selected index.
- Field Value:
- 3
public static final int OK_CANCEL_OPTION
OK/CANCEL confirmation confirmation option.An underlying security service specifies this as the
optionType
to aConfirmationCallback
constructor if it requires a confirmation which can be answered with eitherOK
orCANCEL
.
- Field Value:
- 2
public static final int UNSPECIFIED_OPTION
Unspecified option type.The
getOptionType
method returns this value if thisConfirmationCallback
was instantiated withoptions
instead of anoptionType
.
- Field Value:
- -1
public static final int YES
YES option.If an
optionType
was specified to thisConfirmationCallback
, this option may be specified as adefaultOption
or returned as the selected index.
- Field Value:
- 0
public static final int YES_NO_CANCEL_OPTION
YES/NO/CANCEL confirmation confirmation option.An underlying security service specifies this as the
optionType
to aConfirmationCallback
constructor if it requires a confirmation which can be answered with eitherYES
,NO
orCANCEL
.
- Field Value:
- 1
public static final int YES_NO_OPTION
YES/NO confirmation option.An underlying security service specifies this as the
optionType
to aConfirmationCallback
constructor if it requires a confirmation which can be answered with eitherYES
orNO
.
- Field Value:
- 0
public ConfirmationCallback(int messageType, int optionType, int defaultOption) throws IllegalArgumentException
Construct aConfirmationCallback
with a message type, an option type and a default option.Underlying security services use this constructor if they require either a YES/NO, YES/NO/CANCEL or OK/CANCEL confirmation.
- Parameters:
messageType
- the message type (INFORMATION, WARNING or ERROR).optionType
- the option type (YES_NO_OPTION, YES_NO_CANCEL_OPTION or OK_CANCEL_OPTION).defaultOption
- the default option from the provided optionType (YES, NO, CANCEL or OK).
- Throws:
IllegalArgumentException
- ifmessageType
is not eitherINFORMATION
,WARNING
, orERROR
, ifoptionType
is not eitherYES_NO_OPTION
,YES_NO_CANCEL_OPTION
, orOK_CANCEL_OPTION
, or ifdefaultOption
does not correspond to one of the options inoptionType
.
public ConfirmationCallback(int messageType, String[] options, int defaultOption)
Construct aConfirmationCallback
with a message type, a list of options and a default option.Underlying security services use this constructor if they require a confirmation different from the available preset confirmations provided (for example, CONTINUE/ABORT or STOP/GO). The confirmation options are listed in the
options
array, and are displayed by theCallbackHandler
implementation in a manner consistent with the way preset options are displayed.
- Parameters:
messageType
- the message type (INFORMATION, WARNING or ERROR).options
- the list of confirmation options.defaultOption
- the default option, represented as an index into theoptions
array.
- Throws:
IllegalArgumentException
- ifmessageType
is not eitherINFORMATION
,WARNING
, orERROR
, ifoptions
isnull
, ifoptions
has a length of0
, if any element fromoptions
isnull
, if any element fromoptions
has a length of0
, or ifdefaultOption
does not lie within the array boundaries ofoptions
.
public ConfirmationCallback(String prompt, int messageType, int optionType, int defaultOption)
Construct aConfirmationCallback
with a prompt, message type, an option type and a default option.Underlying security services use this constructor if they require either a YES/NO, YES/NO/CANCEL or OK/CANCEL confirmation.
- Parameters:
prompt
- the prompt used to describe the list of options.messageType
- the message type (INFORMATION, WARNING or ERROR).optionType
- the option type (YES_NO_OPTION, YES_NO_CANCEL_OPTION or OK_CANCEL_OPTION).defaultOption
- the default option from the provided optionType (YES, NO, CANCEL or OK).
- Throws:
IllegalArgumentException
- ifprompt
isnull
, ifprompt
has a length of0
, ifmessageType
is not eitherINFORMATION
,WARNING
, orERROR
, ifoptionType
is not eitherYES_NO_OPTION
,YES_NO_CANCEL_OPTION
, orOK_CANCEL_OPTION
, or ifdefaultOption
does not correspond to one of the options inoptionType
.
public ConfirmationCallback(String prompt, int messageType, String[] options, int defaultOption)
Construct aConfirmationCallback
with a prompt, message type, a list of options and a default option.Underlying security services use this constructor if they require a confirmation different from the available preset confirmations provided (for example, CONTINUE/ABORT or STOP/GO). The confirmation options are listed in the
options
array, and are displayed by theCallbackHandler
implementation in a manner consistent with the way preset options are displayed.
- Parameters:
prompt
- the prompt used to describe the list of options.messageType
- the message type (INFORMATION, WARNING or ERROR).options
- the list of confirmation options.defaultOption
- the default option, represented as an index into theoptions
array.
- Throws:
IllegalArgumentException
- ifprompt
isnull
, ifprompt
has a length of0
, ifmessageType
is not eitherINFORMATION
,WARNING
, orERROR
, ifoptions
isnull
, ifoptions
has a length of0
, if any element fromoptions
isnull
, if any element fromoptions
has a length of0
, or ifdefaultOption
does not lie within the array boundaries ofoptions
.
public int getDefaultOption()
Get the default option.
- Returns:
- the default option, represented as
YES
,NO
,OK
orCANCEL
if anoptionType
was specified to the constructor of thisConfirmationCallback
. Otherwise, this method returns the default option as an index into theoptions
array specified to the constructor of thisConfirmationCallback
.
public int getMessageType()
Get the message type.
- Returns:
- the message type (INFORMATION, WARNING or ERROR).
public int getOptionType()
Get the option type.If this method returns
UNSPECIFIED_OPTION
, then thisConfirmationCallback
was instantiated withoptions
instead of anoptionType
. In this case, invoke thegetOptions()
method to determine which confirmation options to display.
- Returns:
- the option type (YES_NO_OPTION, YES_NO_CANCEL_OPTION or OK_CANCEL_OPTION), or UNSPECIFIED_OPTION if this
ConfirmationCallback
was instantiated withoptions
instead of anoptionType
.
public String[] getOptions()
Get the confirmation options.
- Returns:
- the list of confirmation options, or
null
if thisConfirmationCallback
was instantiated with anoptionType
instead ofoptions
.
public String getPrompt()
Get the prompt.
- Returns:
- the prompt, or
null
if thisConfirmationCallback
was instantiated without a prompt.
public int getSelectedIndex()
Get the selected confirmation option.
- Returns:
- the selected confirmation option represented as
YES
,NO
,OK
orCANCEL
if anoptionType
was specified to the constructor of thisConfirmationCallback
. Otherwise, this method returns the selected confirmation option as an index into theoptions
array specified to the constructor of thisConfirmationCallback
.
- See Also:
setSelectedIndex(int)
public void setSelectedIndex(int selection)
Set the selected confirmation option.
- Parameters:
selection
- the selection represented asYES
,NO
,OK
orCANCEL
if anoptionType
was specified to the constructor of thisConfirmationCallback
. Otherwise, theselection
represents the index into theoptions
array specified to the constructor of thisConfirmationCallback
.
- See Also:
getSelectedIndex()