@Override public void init(ClientSession session, String service) throws Exception { super.init(session, service); maxAttempts = Math.max(1, session.getIntProperty( ClientAuthenticationManager.PASSWORD_PROMPTS, ClientAuthenticationManager.DEFAULT_PASSWORD_PROMPTS)); attempts = 0; }
public SftpFileSystem(SftpFileSystemProvider provider, String id, ClientSession session, SftpClientFactory factory, SftpVersionSelector selector) throws IOException { super(provider); this.id = id; this.clientSession = Objects.requireNonNull(session, "No client session"); this.factory = factory != null ? factory : SftpClientFactory.instance(); this.selector = selector; this.stores = Collections.unmodifiableList(Collections.<FileStore>singletonList(new SftpFileStore(id, this))); this.pool = new LinkedBlockingQueue<>(session.getIntProperty(POOL_SIZE_PROP, DEFAULT_POOL_SIZE)); try (SftpClient client = getClient()) { version = client.getVersion(); defaultDir = getPath(client.canonicalPath(".")); } if (version >= SftpConstants.SFTP_V4) { Set<String> views = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); views.addAll(UNIVERSAL_SUPPORTED_VIEWS); views.add("acl"); supportedViews = Collections.unmodifiableSet(views); } else { supportedViews = UNIVERSAL_SUPPORTED_VIEWS; } }
public SftpFileSystem newFileSystem(ClientSession session) throws IOException { String id = getFileSystemIdentifier(session); SftpFileSystem fileSystem; synchronized (fileSystems) { if (fileSystems.containsKey(id)) { throw new FileSystemAlreadyExistsException(id); } fileSystem = new SftpFileSystem(this, id, session, factory, getSftpVersionSelector()); fileSystems.put(id, fileSystem); } fileSystem.setReadBufferSize(session.getIntProperty(READ_BUFFER_PROP_NAME, DEFAULT_READ_BUFFER_SIZE)); fileSystem.setWriteBufferSize(session.getIntProperty(WRITE_BUFFER_PROP_NAME, DEFAULT_WRITE_BUFFER_SIZE)); if (log.isDebugEnabled()) { log.debug("newFileSystem: {}", fileSystem); } return fileSystem; }
@Override public void init(ClientSession session, String service) throws Exception { super.init(session, service); passwords = ClientSession.passwordIteratorOf(session); maxTrials = session.getIntProperty(ClientAuthenticationManager.PASSWORD_PROMPTS, ClientAuthenticationManager.DEFAULT_PASSWORD_PROMPTS); ValidateUtils.checkTrue(maxTrials > 0, "Non-positive max. trials: %d", maxTrials); }
@Override public void init(ClientSession session, String service) throws Exception { super.init(session, service); passwords = ClientSession.passwordIteratorOf(session); maxTrials = session.getIntProperty( ClientAuthenticationManager.PASSWORD_PROMPTS, ClientAuthenticationManager.DEFAULT_PASSWORD_PROMPTS); ValidateUtils.checkTrue(maxTrials > 0, "Non-positive max. trials: %d", maxTrials); }
int copySize = sftp.getClientSession().getIntProperty(COPY_BUFSIZE_PROP, DEFAULT_TRANSFER_BUFFER_SIZE); boolean completed = false; long curPos = (position >= 0L) ? position : posTracker.get();