TrueZIP Driver TZP (ZIP.RAES) 7.0-rc1

de.schlichtherle.truezip.key
Class PromptingKeyManager<K extends SafeKey<K>>

java.lang.Object
  extended by de.schlichtherle.truezip.key.SafeKeyManager<K,PromptingKeyProvider<K>>
      extended by de.schlichtherle.truezip.key.PromptingKeyManager<K>
Type Parameters:
K - The type of the keys.
All Implemented Interfaces:
KeyManager<K,PromptingKeyProvider<K>>

@ThreadSafe
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
public final class PromptingKeyManager<K extends SafeKey<K>>
extends SafeKeyManager<K,PromptingKeyProvider<K>>

A key manager which prompts the user for a key if required.

Author:
Christian Schlichtherle
See Also:
PromptingKeyProvider

Nested Class Summary
private static class PromptingKeyManager.PromptingKeyProviderFactory<K extends SafeKey<K>>
          A factory for PromptingKeyProviders.
 
Field Summary
private  PromptingKeyProvider.UI<? extends K> ui
          The user interface classes or instances.
 
Constructor Summary
PromptingKeyManager(PromptingKeyProvider.UI<? extends K> ui)
          Constructs a new prompting key manager.
 
Method Summary
 PromptingKeyProvider<K> getKeyProvider(URI resource)
          Returns the key provider for the given protected resource.
 boolean moveKeyProvider(URI oldResource, URI newResource)
          Moves the key provider from the URI oldResource to newResource.
 boolean removeKeyProvider(URI resource)
          Removes the key provider for the given protected resource.
 
Methods inherited from class de.schlichtherle.truezip.key.SafeKeyManager
findKeyProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ui

private final PromptingKeyProvider.UI<? extends K extends SafeKey<K>> ui
The user interface classes or instances. Values may be instances of PromptingKeyProvider.UI or Class.

Constructor Detail

PromptingKeyManager

public PromptingKeyManager(PromptingKeyProvider.UI<? extends K> ui)
Constructs a new prompting key manager.

Parameters:
ui - the user interface for prompting for keys.
Method Detail

getKeyProvider

public PromptingKeyProvider<K> getKeyProvider(URI resource)
Description copied from interface: KeyManager
Returns the key provider for the given protected resource. If no key provider is mapped, a new key provider is created and returned.

Specified by:
getKeyProvider in interface KeyManager<K extends SafeKey<K>,PromptingKeyProvider<K extends SafeKey<K>>>
Overrides:
getKeyProvider in class SafeKeyManager<K extends SafeKey<K>,PromptingKeyProvider<K extends SafeKey<K>>>
Parameters:
resource - the URI of the protected resource.
Returns:
The key provider mapped for the protected resource.

moveKeyProvider

public boolean moveKeyProvider(URI oldResource,
                               URI newResource)
Description copied from interface: KeyManager
Moves the key provider from the URI oldResource to newResource.

Specified by:
moveKeyProvider in interface KeyManager<K extends SafeKey<K>,PromptingKeyProvider<K extends SafeKey<K>>>
Overrides:
moveKeyProvider in class SafeKeyManager<K extends SafeKey<K>,PromptingKeyProvider<K extends SafeKey<K>>>
Parameters:
oldResource - the old URI of the protected resource.
newResource - the new URI of the protected resource.
Returns:
whether or not the operation succeeded, i.e. if a key provider was present for the old URI.

removeKeyProvider

public boolean removeKeyProvider(URI resource)
Description copied from interface: KeyManager
Removes the key provider for the given protected resource.

Specified by:
removeKeyProvider in interface KeyManager<K extends SafeKey<K>,PromptingKeyProvider<K extends SafeKey<K>>>
Overrides:
removeKeyProvider in class SafeKeyManager<K extends SafeKey<K>,PromptingKeyProvider<K extends SafeKey<K>>>
Parameters:
resource - the URI of the protected resource.
Returns:
whether or not the operation succeeded, i.e. if a key provider was present for the old URI.

TrueZIP Driver TZP (ZIP.RAES) 7.0-rc1

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.