Package com.jcraft.jsch

Examples of com.jcraft.jsch.ChannelSftp.connect()


    try {

      //prepare directory:
      ChannelSftp sftpChannel = (ChannelSftp)session.openChannel("sftp");
      try {
        sftpChannel.connect();
        prepareDirectory(sftpChannel);
        sftpChannel.disconnect();
      }
      finally {
        if (sftpChannel.isConnected())
View Full Code Here


    transfer.getDirectory(super.remotePath, localWorkdir, 0);

    //delete remote directory:
    if (deleteRemoteDirectory) {
      ChannelSftp sftp = (ChannelSftp)session.openChannel("sftp");
      sftp.connect();
      try {
        rmdir(sftp, super.remotePath);
      }
      finally {
        if (sftp.isConnected())
View Full Code Here

     * @throws JSchException on errors detected by scp
     */
    public void execute() throws IOException, JSchException {
        ChannelSftp channel = openSftpChannel();
        try {
            channel.connect();
            try {
                SftpATTRS attrs = channel.stat(remoteFile);
                if (attrs.isDir() && !remoteFile.endsWith("/")) {
                    remoteFile = remoteFile + "/";
                }
View Full Code Here

    }

    private void doSingleTransfer() throws IOException, JSchException {
        ChannelSftp channel = openSftpChannel();
        try {
            channel.connect();
            try {
                sendFileToRemote(channel, localFile, remotePath);
            } catch (SftpException e) {
                throw new JSchException(e.toString());
            }
View Full Code Here

    }

    private void doMultipleTransfer() throws IOException, JSchException {
        ChannelSftp channel = openSftpChannel();
        try {
            channel.connect();

            try {
                channel.cd(remotePath);
                for (Iterator i = directoryList.iterator(); i.hasNext();) {
                    Directory current = (Directory) i.next();
View Full Code Here

     * @throws JSchException on errors detected by scp
     */
    public void execute() throws IOException, JSchException {
        ChannelSftp channel = openSftpChannel();
        try {
            channel.connect();
            try {
                SftpATTRS attrs = channel.stat(remoteFile);
                if (attrs.isDir() && !remoteFile.endsWith("/")) {
                    remoteFile = remoteFile + "/";
                }
View Full Code Here

        String host = session.getHost();
        ChannelSftp channel = SshCache.getInstance().getChannelSftp(session);
        if (channel == null) {
            try {
                channel = (ChannelSftp) session.openChannel("sftp");
                channel.connect();
                Message.verbose(":: SFTP :: connected to " + host + "!");
                SshCache.getInstance().attachChannelSftp(session, channel);
            } catch (JSchException e) {
                IOException ex = new IOException(e.getMessage());
                ex.initCause(e);
View Full Code Here

    final Session session = newSession();

    final ChannelSftp channel = (ChannelSftp) session.openChannel("sftp");

    channel.connect();

    //

    final SftpProgressMonitor monitor = new SftpProgressMonitor() {
View Full Code Here

    final Session session = newSession();

    final ChannelSftp channel = (ChannelSftp) session.openChannel("sftp");

    channel.connect();

    final SftpProgressMonitor monitor = new SftpProgressMonitor() {

      @Override
      public void init(final int op, final String source,
View Full Code Here

     * @throws JSchException on errors detected by scp
     */
    public void execute() throws IOException, JSchException {
        ChannelSftp channel = openSftpChannel();
        try {
            channel.connect();
            try {
                SftpATTRS attrs = channel.stat(remoteFile);
                if (attrs.isDir() && !remoteFile.endsWith("/")) {
                    remoteFile = remoteFile + "/";
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.