Package com.jcraft.jsch

Examples of com.jcraft.jsch.Session.openChannel()


    logger.info("sftp source: " + source);
    logger.info("sftp target: " + target);

    final Session session = getSession();

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

    channel.connect();

    //
View Full Code Here


      throw new OpenShiftSSHOperationException("No SSH session available for application ''{0}''", this.getName());
    }
    Channel channel = null;
    BufferedReader reader = null;
    try {
      session.openChannel("exec");
      channel = session.openChannel("exec");
      ((ChannelExec) channel).setCommand(command);
      channel.connect();
      return sshStream.getLines(channel);
    } catch (JSchException e) {
View Full Code Here

    }
    Channel channel = null;
    BufferedReader reader = null;
    try {
      session.openChannel("exec");
      channel = session.openChannel("exec");
      ((ChannelExec) channel).setCommand(command);
      channel.connect();
      return sshStream.getLines(channel);
    } catch (JSchException e) {
      throw new OpenShiftSSHOperationException(e, "Failed to execute remote ssh command \"{0}\"",
View Full Code Here

      ChannelSftp cSftp = null;
      try {
        session.connect(10000);

        cSftp = (ChannelSftp) session.openChannel("sftp");
        cSftp.connect();
      } catch (JSchException e) {
        logger.error("Cannot connect to JSch session for user: " + user
            + ", host: " + server + ", port: " + port);
        return;
View Full Code Here

        try {
            // execute the command
            Session session = openSession();
            session.setTimeout((int) maxwait);
            final ChannelExec channel = (ChannelExec) session.openChannel("exec");
            channel.setCommand(command);
            channel.setOutputStream(tee);
            channel.connect();

            // wait for it to finish
View Full Code Here

           
            // trying to connect ...
            session.connect();       
           
            String command="scp -p -t " + remoteName;
            final Channel channel = session.openChannel("exec");
            ((ChannelExec)channel).setCommand(command);       
           
            // get I/O streams for remote scp
            final OutputStream out=channel.getOutputStream();
            final InputStream in=channel.getInputStream();
View Full Code Here

            session.setPassword(fsdef.getPassword());
        }
        session.connect();

        //Open a new session for SFTP.
        Channel channel = session.openChannel("sftp");
        channel.connect();

        //checking SSH client connection.
        if (!channel.isConnected()) {
            logger.warn("Cannot connect with SSH to {}@{}", fsdef.getUsername(),
View Full Code Here

    if (s.isConnected()) {
      final String targetFileName = scpUtil
          .trimTargetFile(directoryOrFile.getPath());
      final String command = LS_START_COMMAND + targetFileName
          + LS_END_COMMAND;
      channel = (ChannelExec) s.openChannel(SCP_EXEC);
      channel.setCommand(command);
      final OutputStream outs = channel.getOutputStream();
      inputStream = channel.getInputStream();
      channel.connect();
View Full Code Here

      scpUtil = new ScpUtil(this);
      final Session s = scpUtil.getSession();
      s.connect();
      final String targetFileName = scpUtil.trimTargetFile(url.getPath());
      final String command = SCP_COMMAND + targetFileName;
      channel = (ChannelExec) s.openChannel(SCP_EXEC);
      channel.setCommand(command);
      final OutputStream outs = channel.getOutputStream();
      responseStream = channel.getInputStream();
      channel.connect();
      scpUtil.checkAck(responseStream);
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.