Package org.apache.sshd.sftp.client.fs
Class SftpFileSystemProvider.SessionProvider
- java.lang.Object
-
- org.apache.sshd.sftp.client.fs.SftpFileSystemProvider.SessionProvider
-
- All Implemented Interfaces:
IOFunction<java.lang.Boolean,ClientSession>
- Enclosing class:
- SftpFileSystemProvider
private class SftpFileSystemProvider.SessionProvider extends java.lang.Object implements IOFunction<java.lang.Boolean,ClientSession>
A session provider that automatically creates a new session if the current one is no longer open (or if there isn't one yet). It returns fully authenticated sessions.
-
-
Field Summary
Fields Modifier and Type Field Description private SftpFileSystemInitializationContext
context
private java.util.concurrent.atomic.AtomicReference<ClientSession>
currentSession
private java.nio.charset.Charset
decodingCharset
private java.util.Map<java.lang.String,?>
params
-
Constructor Summary
Constructors Constructor Description SessionProvider(SftpFileSystemInitializationContext context, java.util.Map<java.lang.String,?> params, java.nio.charset.Charset decodingCharset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClientSession
apply(java.lang.Boolean create)
Retrieves the currentClientSession
and optionally creates a new one if there is no current session yet, or if it is not open.private ClientSession
create()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.util.io.functors.IOFunction
andThen, compose
-
-
-
-
Field Detail
-
context
private final SftpFileSystemInitializationContext context
-
params
private final java.util.Map<java.lang.String,?> params
-
decodingCharset
private final java.nio.charset.Charset decodingCharset
-
currentSession
private java.util.concurrent.atomic.AtomicReference<ClientSession> currentSession
-
-
Constructor Detail
-
SessionProvider
SessionProvider(SftpFileSystemInitializationContext context, java.util.Map<java.lang.String,?> params, java.nio.charset.Charset decodingCharset)
-
-
Method Detail
-
apply
public ClientSession apply(java.lang.Boolean create) throws java.io.IOException
Retrieves the currentClientSession
and optionally creates a new one if there is no current session yet, or if it is not open.- Specified by:
apply
in interfaceIOFunction<java.lang.Boolean,ClientSession>
- Parameters:
create
-Boolean.TRUE
to create a new session if needed, otherwise just query the current session.- Throws:
java.io.IOException
-
create
private ClientSession create() throws java.io.IOException
- Throws:
java.io.IOException
-
-