|
TrueZIP Driver TZP (ZIP.RAES) 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.truezip.key.SafeKeyProvider<K>
de.schlichtherle.truezip.key.PromptingKeyProvider<K>
K - The type of the keys.@ThreadSafe public final class PromptingKeyProvider<K extends SafeKey<K>>
A "safe" key provider which prompts the user for a key for its protected
resource.
The user is prompted via an instance of the PromptingKeyProvider.UI user interface which
is injected to this instance by a PromptingKeyManager.
The UI may then display the resource URI by calling getResource() on
this instance (which is also injected by a
PromptingKeyManager) and finally set the key by calling
setKey(K).
PromptingKeyManager| Nested Class Summary | |
|---|---|
(package private) static class |
PromptingKeyProvider.State
Implements the behavior strategy of its enclosing class. |
static interface |
PromptingKeyProvider.UI<K extends SafeKey<K>>
Used for the actual prompting of the user for a key (a password for example) which is required to access a protected resource. |
| Nested classes/interfaces inherited from interface de.schlichtherle.truezip.key.KeyProvider |
|---|
KeyProvider.Factory<K,P extends KeyProvider<K>> |
| Field Summary | |
|---|---|
private boolean |
changeKeySelected
|
private K |
key
|
private URI |
resource
The resource identifier for the protected resource. |
private PromptingKeyProvider.State |
state
|
private PromptingKeyProvider.UI<? extends K> |
ui
The user interface instance which is used to prompt the user for a key. |
| Fields inherited from class de.schlichtherle.truezip.key.SafeKeyProvider |
|---|
MIN_KEY_RETRY_DELAY |
| Constructor Summary | |
|---|---|
PromptingKeyProvider()
|
|
| Method Summary | |
|---|---|
protected K |
getCreateKeyImpl()
Returns the key which should be used to create a new protected resource or entirely replace the contents of an already existing protected resource. |
(package private) K |
getKey()
Returns the key property maintained by this key provider. |
protected K |
getOpenKeyImpl(boolean invalid)
Returns the key which should be used to open an existing protected resource in order to access its contents. |
URI |
getResource()
Returns the unique resource identifier (resource ID) of the protected resource for which this key provider is used. |
(package private) PromptingKeyProvider.State |
getState()
|
(package private) PromptingKeyProvider.UI<? extends K> |
getUI()
|
(package private) boolean |
isChangeKeySelected()
Returns whether or not the user shall get prompted for a new key upon the next call to SafeKeyProvider.getCreateKey(), provided that the key
has been set before. |
private void |
reset()
|
void |
resetCancelledKey()
Resets the state of this key provider and the current key if and only if prompting for a key has been cancelled. |
void |
resetUnconditionally()
Resets the state of this key provider and the current key unconditionally. |
void |
setChangeKeySelected(boolean changeKeySelected)
Requests to prompt the user for a new key upon the next call to SafeKeyProvider.getCreateKey(), provided that the key has been
set before. |
void |
setKey(K key)
Sets the key property maintained by this key provider. |
private void |
setKeyImpl(K newKey)
|
(package private) void |
setResource(URI resource)
Returns the unique resource identifier (resource ID) of the protected resource for which this key provider is used. |
private void |
setState(PromptingKeyProvider.State state)
|
(package private) void |
setUI(PromptingKeyProvider.UI<? extends K> ui)
|
| Methods inherited from class de.schlichtherle.truezip.key.SafeKeyProvider |
|---|
clone, getCreateKey, getOpenKey, reset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@NonNull private volatile PromptingKeyProvider.State state
private volatile URI resource
private volatile PromptingKeyProvider.UI<? extends K extends SafeKey<K>> ui
private volatile K extends SafeKey<K> key
private volatile boolean changeKeySelected
| Constructor Detail |
|---|
public PromptingKeyProvider()
| Method Detail |
|---|
public URI getResource()
null.
void setResource(URI resource)
null.
final PromptingKeyProvider.UI<? extends K> getUI()
final void setUI(PromptingKeyProvider.UI<? extends K> ui)
@NonNull PromptingKeyProvider.State getState()
private void setState(@NonNull
PromptingKeyProvider.State state)
protected final K getCreateKeyImpl()
throws UnknownKeyException
If required or explicitly requested by the user, the user is prompted for this key.
getCreateKeyImpl in class SafeKeyProvider<K extends SafeKey<K>>key to clone or null.
UnknownKeyException - If the user has cancelled prompting or
prompting has been disabled by the PromptingKeyManager.KeyProvider.getCreateKey()
protected final K getOpenKeyImpl(boolean invalid)
throws UnknownKeyException
If required, the user is prompted for this key.
getOpenKeyImpl in class SafeKeyProvider<K extends SafeKey<K>>key to use or null.
UnknownKeyException - If the user has cancelled prompting or
prompting has been disabled by the PromptingKeyManager.KeyProvider.getOpenKey(boolean)K getKey()
key property maintained by this key provider.
Client applications should not call this method directly
but rather call SafeKeyProvider.getOpenKey(boolean) or SafeKeyProvider.getCreateKey():
It's intended to be used by subclasses and user interface classes only.
key property.
public void setKey(@CheckForNull
K key)
key property maintained by this key provider.
Client applications should not call this method directly:
It's intended to be used by user interface classes only.
key - The key property.
IllegalStateException - if setting the key is not legal in the
current state.
private void setKeyImpl(@CheckForNull
K newKey)
boolean isChangeKeySelected()
SafeKeyProvider.getCreateKey(), provided that the key
has been set before.
SafeKeyProvider.getCreateKey(), provided that the key
has been set before.public void setChangeKeySelected(boolean changeKeySelected)
SafeKeyProvider.getCreateKey(), provided that the key has been
set before.
changeKeySelected - whether or not the user shall get prompted for
a new key upon the next call to SafeKeyProvider.getCreateKey(), provided
that the key has been set before.public void resetCancelledKey()
public void resetUnconditionally()
private void reset()
|
TrueZIP Driver TZP (ZIP.RAES) 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||