|
TrueZIP 6.8 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.schlichtherle.key.passwd.console.PromptingKeyProviderUI
public class PromptingKeyProviderUI
A out I/O based user interface to prompt for passwords. This class is thread safe.
| Field Summary | |
|---|---|
protected static Console |
con
The console to use for I/O. |
protected static ResourceBundle |
resources
|
| Constructor Summary | |
|---|---|
PromptingKeyProviderUI()
|
|
| Method Summary | |
|---|---|
protected Console |
printf(String format)
|
protected Console |
printf(String format,
Object arg)
|
void |
promptCreateKey(PromptingKeyProvider provider)
Prompts the user for the key which may be used to create a new protected resource or entirely replace the contents of an already existing protected resource. |
protected void |
promptExtraData(PromptingKeyProvider provider)
|
boolean |
promptInvalidOpenKey(PromptingKeyProvider provider)
Prompts the user for the key which may be used to open an existing protected resource in order to access its contents. |
boolean |
promptUnknownOpenKey(PromptingKeyProvider provider)
Prompts the user for the key which may be used to open an existing protected resource in order to access its contents. |
protected String |
readLine(String format)
|
protected String |
readLine(String format,
Object arg)
|
protected char[] |
readPassword(String format)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final ResourceBundle resources
protected static final Console con
null, the prompt methods are never called, so it's
safe to assume that it's not null in these methods.
| Constructor Detail |
|---|
public PromptingKeyProviderUI()
| Method Detail |
|---|
public final void promptCreateKey(PromptingKeyProvider provider)
PromptingKeyProviderUI
Upon return, the implementation is expected to update the common key
in provider.
Upon return, if provider.getKey() returns null,
prompting for the key is assumed to have been cancelled by the user.
In this case, the current and each subsequent call to
KeyProvider.getOpenKey() or KeyProvider.getCreateKey()
by the client results in an UnknownKeyException and the user
is not prompted anymore until the provider is reset by the
KeyManager.
Otherwise, the key is used as the common key, a clone of which is
provided to the client upon request.
Hint: If the user cancels the dialog, it is recommended to
leave the provider's key property simply unmodified.
This causes the old key to be reused and allows the client to
continue its operation as if the user would not have requested to
change the key.
Since TrueZIP 6.4, an implementation may also throw a
RuntimeException with any kind of UnknownKeyException
as its cause.
This will trigger the calling method in the
PromptingKeyProvider class to unwrap and pass on the
cause without changing its state.
This may be useful if prompting was interrupted by a call to
Thread.interrupt() while waiting on the Event Dispatch Thread.
In this case, another try to prompt the user should have the chance to
succeed instead of being cancelled without actually prompting the user
again.
To trigger this behaviour, the implementation should simply throw any
kind of RuntimeException with a
KeyPromptingInterruptedException as its cause.
promptCreateKey in interface PromptingKeyProviderUIprovider - The default key provider to store the result in.protected void promptExtraData(PromptingKeyProvider provider)
public final boolean promptUnknownOpenKey(PromptingKeyProvider provider)
PromptingKeyProviderUI
Upon return, the implementation is expected to update the common key
in provider.
Upon return, if provider.getKey() returns null,
prompting for the key is assumed to have been cancelled by the user.
In this case, the current and each subsequent call to
KeyProvider.getOpenKey() or KeyProvider.getCreateKey()
by the client results in an UnknownKeyException and the user
is not prompted anymore until the provider is reset by the
KeyManager.
Otherwise, the key is used as the common key, a clone of which is
provided to the client upon request.
Since TrueZIP 6.4, an implementation may also throw a
RuntimeException with any kind of UnknownKeyException
as its cause.
This will trigger the calling method in the
PromptingKeyProvider class to unwrap and pass on the
cause without changing its state.
This may be useful if prompting was interrupted by a call to
Thread.interrupt() while waiting on the Event Dispatch Thread.
In this case, another try to prompt the user should have the chance to
succeed instead of being cancelled without actually prompting the user
again.
To trigger this behaviour, the implementation should simply throw any
kind of RuntimeException with a
KeyPromptingInterruptedException as its cause.
promptUnknownOpenKey in interface PromptingKeyProviderUIprovider - The key provider to store the result in.
true if the user has requested to change the
provided key.public final boolean promptInvalidOpenKey(PromptingKeyProvider provider)
PromptingKeyProviderUIPromptingKeyProviderUI.promptUnknownOpenKey(de.schlichtherle.key.PromptingKeyProvider) is invalid.
Upon return, the implementation is expected to update the common key
in provider.
Upon return, if provider.getKey() returns null,
prompting for the key is assumed to have been cancelled by the user.
In this case, the current and each subsequent call to
KeyProvider.getOpenKey() or KeyProvider.getCreateKey()
by the client results in an UnknownKeyException and the user
is not prompted anymore until the provider is reset by the
KeyManager.
Otherwise, the key is used as the common key, a clone of which is
provided to the client upon request.
Since TrueZIP 6.4, an implementation may also throw a
RuntimeException with any kind of UnknownKeyException
as its cause.
This will trigger the calling method in the
PromptingKeyProvider class to unwrap and pass on the
cause without changing its state.
This may be useful if prompting was interrupted by a call to
Thread.interrupt() while waiting on the Event Dispatch Thread.
In this case, another try to prompt the user should have the chance to
succeed instead of being cancelled without actually prompting the user
again.
To trigger this behaviour, the implementation should simply throw any
kind of RuntimeException with a
KeyPromptingInterruptedException as its cause.
promptInvalidOpenKey in interface PromptingKeyProviderUIprovider - The key provider to store the result in.
true if the user has requested to change the
provided key.protected final Console printf(String format)
protected final Console printf(String format,
Object arg)
protected final String readLine(String format)
protected final String readLine(String format,
Object arg)
protected final char[] readPassword(String format)
|
TrueZIP 6.8 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||