|
TrueZIP Driver ZIP.RAES (TZP) 7.1 | ||||||||
| 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.View interface which
is injected to this instance by a PromptingKeyManager.
The view 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 using the given
PromptingKeyProvider.Controller.
PromptingKeyManager| Nested Class Summary | |
|---|---|
static class |
PromptingKeyProvider.Controller<K extends SafeKey<K>>
Proxies access to the key for PromptingKeyProvider.View implementations. |
static class |
PromptingKeyProvider.Factory<K extends SafeKey<K>>
A factory for PromptingKeyProviders. |
private static class |
PromptingKeyProvider.ReadController<K extends SafeKey<K>>
|
(package private) static class |
PromptingKeyProvider.State
Implements the behavior strategy of its enclosing class. |
static interface |
PromptingKeyProvider.View<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. |
private static class |
PromptingKeyProvider.WriteController<K extends SafeKey<K>>
|
| Field Summary | |
|---|---|
private boolean |
changeRequested
|
private K |
key
|
private URI |
resource
The resource identifier for the protected resource. |
private PromptingKeyProvider.State |
state
|
private PromptingKeyProvider.View<K> |
view
The view 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 | |
|---|---|
private K |
getKey()
|
protected K |
getReadKeyImpl(boolean invalid)
Returns the key for reading the contents of an existing protected resource. |
URI |
getResource()
Returns the unique resource identifier (resource ID) of the protected resource for which this key provider is used. |
private PromptingKeyProvider.State |
getState()
|
(package private) PromptingKeyProvider.View<K> |
getView()
|
protected K |
getWriteKeyImpl()
Returns the key for (over)writing the contents of a new or existing protected resource. |
private boolean |
isChangeRequested()
Returns whether or not the user shall get prompted for a new key upon the next call to SafeKeyProvider.getWriteKey(), provided that the key
has been set before. |
private void |
reset()
|
void |
resetCancelledKey()
Resets the state of this key provider, its current key and the value of its changeRequested property
if and only if prompting for a key has been cancelled. |
void |
resetUnconditionally()
Resets the state of this key provider, its current key and the value of its changeRequested property
unconditionally. |
private void |
setChangeRequested(boolean changeRequested)
|
void |
setKey(K newKey)
Sets the key programmatically. |
(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 |
setView(PromptingKeyProvider.View<K> view)
|
| Methods inherited from class de.schlichtherle.truezip.key.SafeKeyProvider |
|---|
clone, getReadKey, getWriteKey, reset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@CheckForNull private volatile URI resource
@CheckForNull private volatile PromptingKeyProvider.View<K extends SafeKey<K>> view
@NonNull private volatile PromptingKeyProvider.State state
@CheckForNull private volatile K extends SafeKey<K> key
private volatile boolean changeRequested
| Constructor Detail |
|---|
public PromptingKeyProvider()
| Method Detail |
|---|
public URI getResource()
null.
void setResource(URI resource)
null.
final PromptingKeyProvider.View<K> getView()
final void setView(PromptingKeyProvider.View<K> view)
@NonNull private PromptingKeyProvider.State getState()
private void setState(@NonNull
PromptingKeyProvider.State state)
protected final K getWriteKeyImpl()
throws UnknownKeyException
SafeKeyProviderSubsequent calls to this method may return the same object.
getWriteKeyImpl in class SafeKeyProvider<K extends SafeKey<K>>UnknownKeyException - if the required key is unknown for some
reason, e.g. if prompting for the key has been disabled or
cancelled by the user.SafeKeyProvider.getWriteKey()
protected final K getReadKeyImpl(boolean invalid)
throws UnknownKeyException
SafeKeyProviderSubsequent calls to this method may return the same object.
getReadKeyImpl in class SafeKeyProvider<K extends SafeKey<K>>UnknownKeyException - If the required key is unknown.
At the subclasses discretion, this may mean that prompting for
the key has been disabled or cancelled by the user.KeyProvider.getWriteKey()@CheckForNull private K getKey()
public void setKey(@CheckForNull
K newKey)
KeyProvider
newKey - the key.
If this is null, this key provider is set to a state
as if prompting for the key had been disabled or cancelled.private boolean isChangeRequested()
SafeKeyProvider.getWriteKey(), provided that the key
has been set before.
SafeKeyProvider.getWriteKey(), provided that the key
has been set before.private void setChangeRequested(boolean changeRequested)
public void resetCancelledKey()
changeRequested property
if and only if prompting for a key has been cancelled.
public void resetUnconditionally()
changeRequested property
unconditionally.
private void reset()
|
TrueZIP Driver ZIP.RAES (TZP) 7.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||