Top Description Fields Constructors Methods
org.apache.sshd.client.config.keys

public Class LazyClientIdentityIterator

extends Object
implements Iterator<KeyPair>
Class Inheritance
All Implemented Interfaces
java.util.Iterator
Imports
java.security.KeyPair, java.util.Iterator, .NoSuchElementException, .Objects, java.util.function.Function, .Predicate, org.apache.sshd.common.keyprovider.KeyIdentityProvider

Wraps several ClientIdentityProvider into a KeyPair Iterator that invokes each provider "lazily" - i.e., only when Iterator#hasNext() is invoked. This prevents password protected private keys to be decrypted until they are actually needed.
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
protected Iterator<KeyPair>
protected KeyPair
private final Predicate<KeyPair>
protected boolean
private final Function<? super ClientIdentityProvider, ? extends Iterable<KeyPair>>
private final Iterator<? extends ClientIdentityProvider>

Constructor Summary

AccessConstructor and Description
public
LazyClientIdentityIterator(Iterator<? extends ClientIdentityProvider>
The providers - ignored if null
providers
,
Function<? super ClientIdentityProvider, ? extends Iterable<KeyPair>>
The (never null) extractor of the KeyPair from the ClientIdentityProvider argument. If returned pair is null then next provider is queried.
kpExtractor
,
Predicate<KeyPair>
Any further filter to apply on (non-null) key pairs before returning it as the Iterator#next() result.
filter
)

Method Summary

Modifier and TypeMethod and Description
public Predicate<KeyPair>
public Function<? super ClientIdentityProvider, ? extends Iterable<KeyPair>>
public Iterator<? extends ClientIdentityProvider>
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public KeyPair
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

currentIdentitiesback to summary
protected Iterator<KeyPair> currentIdentities
currentPairback to summary
protected KeyPair currentPair
filterback to summary
private final Predicate<KeyPair> filter
finishedback to summary
protected boolean finished
kpExtractorback to summary
private final Function<? super ClientIdentityProvider, ? extends Iterable<KeyPair>> kpExtractor
providersback to summary
private final Iterator<? extends ClientIdentityProvider> providers

Constructor Detail

LazyClientIdentityIteratorback to summary
public LazyClientIdentityIterator(Iterator<? extends ClientIdentityProvider> providers, Function<? super ClientIdentityProvider, ? extends Iterable<KeyPair>> kpExtractor, Predicate<KeyPair> filter)
Parameters
providers:Iterator<? extends ClientIdentityProvider>

The providers - ignored if null

kpExtractor:Function<? super ClientIdentityProvider, ? extends Iterable<KeyPair>>

The (never null) extractor of the KeyPair from the ClientIdentityProvider argument. If returned pair is null then next provider is queried.

filter:Predicate<KeyPair>

Any further filter to apply on (non-null) key pairs before returning it as the Iterator#next() result.

Method Detail

getFilterback to summary
public Predicate<KeyPair> getFilter()
getIdentitiesExtractorback to summary
public Function<? super ClientIdentityProvider, ? extends Iterable<KeyPair>> getIdentitiesExtractor()
getProvidersback to summary
public Iterator<? extends ClientIdentityProvider> getProviders()
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public KeyPair next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:KeyPair

the next element in the iteration

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override