fix for compile
This commit is contained in:
parent
1d256a70d1
commit
1f52dedf13
2 changed files with 15 additions and 21 deletions
|
@ -1,4 +1,14 @@
|
|||
package org.xbib.files.sftp.jadaptive.fs;
|
||||
|
||||
import java.nio.channels.ByteChannel;
|
||||
import java.nio.file.OpenOption;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Set;
|
||||
|
||||
public class SftpFileSystemProvider {
|
||||
|
||||
public ByteChannel newByteChannel(Path path, Set<? extends OpenOption> options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,39 +1,23 @@
|
|||
package org.xbib.files.sftp.jadaptive.fs.spi;
|
||||
|
||||
import org.xbib.files.sftp.jadaptive.fs.SftpFileSystem;
|
||||
import org.xbib.files.sftp.jadaptive.fs.SftpFileSystemProvider;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import org.xbib.files.sftp.jadaptive.fs.SftpFileSystem;
|
||||
import org.xbib.files.sftp.jadaptive.fs.SftpFileSystemProvider;
|
||||
|
||||
public class SFTPContext implements Closeable {
|
||||
|
||||
final SftpFileSystemProvider provider;
|
||||
SftpFileSystemProvider provider;
|
||||
|
||||
final SftpFileSystem fileSystem;
|
||||
SftpFileSystem fileSystem;
|
||||
|
||||
public SFTPContext(URI uri, Map<String, ?> env) throws IOException {
|
||||
this.sshClient = ClientBuilder.builder().build();
|
||||
Object object = env.get("workers");
|
||||
if (object instanceof Integer) {
|
||||
sshClient.setNioWorkers((Integer) object);
|
||||
} else if (object instanceof String) {
|
||||
sshClient.setNioWorkers(Integer.parseInt((String) object));
|
||||
} else {
|
||||
// we do not require a vast pool of threads
|
||||
sshClient.setNioWorkers(1);
|
||||
}
|
||||
sshClient.start();
|
||||
this.provider = new SftpFileSystemProvider(sshClient);
|
||||
this.fileSystem = provider.newFileSystem(uri, env);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
sshClient.stop();
|
||||
sshClient.close();
|
||||
fileSystem.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue