TrueZIP Driver ZIP.RAES (TZP) 7.1

de.schlichtherle.truezip.key
Class SafeKeyManager<K extends SafeKey<K>,P extends SafeKeyProvider<K>>

java.lang.Object
  extended by de.schlichtherle.truezip.key.SafeKeyManager<K,P>
All Implemented Interfaces:
KeyManager<K>
Direct Known Subclasses:
PromptingKeyManager

@ThreadSafe
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
public class SafeKeyManager<K extends SafeKey<K>,P extends SafeKeyProvider<K>>
extends Object
implements KeyManager<K>

Uses a map to hold the safe key providers managed by this instance.

Author:
Christian Schlichtherle

Field Summary
private  KeyProvider.Factory<? extends P> factory
           
private  Map<URI,P> providers
           
 
Constructor Summary
SafeKeyManager(KeyProvider.Factory<? extends P> factory)
          Constructs a new default key manager.
 
Method Summary
 P getKeyProvider(URI resource)
          Returns the key provider for the given protected resource.
 P moveKeyProvider(URI oldResource, URI newResource)
          Moves the key provider from the URI oldResource to newResource.
 P removeKeyProvider(URI resource)
          Removes the key provider for the given protected resource.
private  P removeKeyProvider0(URI resource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

providers

private final Map<URI,P extends SafeKeyProvider<K>> providers

factory

private final KeyProvider.Factory<? extends P extends SafeKeyProvider<K>> factory
Constructor Detail

SafeKeyManager

public SafeKeyManager(KeyProvider.Factory<? extends P> factory)
Constructs a new default key manager.

Parameters:
factory - the factory for creating new key providers.
Method Detail

getKeyProvider

public P 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>>
Parameters:
resource - the URI of the protected resource.
Returns:
The key provider mapped for the protected resource.

moveKeyProvider

public P 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>>
Parameters:
oldResource - the old URI of the protected resource.
newResource - the new URI of the protected resource.
Returns:
The key provider which was previously mapped for the protected resource newResource.

removeKeyProvider

public P 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>>
Parameters:
resource - the URI of the protected resource.
Returns:
The key provider which was previously mapped for the protected resource.

removeKeyProvider0

private P removeKeyProvider0(URI resource)

TrueZIP Driver ZIP.RAES (TZP) 7.1

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