Package com.jcraft.jsch

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


           
            // get I/O streams for remote scp
            final OutputStream out=channel.getOutputStream();
            final InputStream in=channel.getInputStream();
           
            channel.connect();
           
            checkAck(in);
           
            // send "C0644 filesize filename", where filename should not include '/'
            final int filesize=(int)(localFile).length();
View Full Code Here


        // get I/O streams for remote scp
        OutputStream out = channel.getOutputStream();
        final InputStream in = channel.getInputStream();

        channel.connect();

        if (checkAck(in) != 0) {
          throw new CoreException(SSH_FAILED_STATUS1);
        }
View Full Code Here

        String jarDir = "/tmp/hadoopjar"
            + new VMID().toString().replace(':', '_');
        command = "mkdir " + jarDir + ";mv " + remoteFile + " " + jarDir;
        channel = session.openChannel("exec");
        ((ChannelExec) channel).setCommand(command);
        channel.connect();
        channel.disconnect();

        session.disconnect();

        // we create a new session with a zero timeout to prevent the
View Full Code Here

            String command =
                server.getInstallPath() + "/bin/hadoop job -kill " + jobId;
            Channel channel = session.openChannel("exec");
            ((ChannelExec) channel).setCommand(command);
            channel.connect();
            channel.disconnect();

            session.disconnect();
          } catch (JSchException e) {
            e.printStackTrace();
View Full Code Here

        JSch sch = new JSch();
        com.jcraft.jsch.Session s = sch.getSession("smx", "localhost", port);
        s.setUserInfo(new SimpleUserInfo("smx"));
        s.connect();
        Channel c = s.openChannel("shell");
        c.connect();
        OutputStream os = c.getOutputStream();
        os.write("this is my command".getBytes());
        os.flush();
        Thread.sleep(100);
        c.disconnect();
View Full Code Here

        try {
            // get I/O streams for remote scp
            OutputStream out = channel.getOutputStream();
            InputStream in = channel.getInputStream();

            channel.connect();

            sendAck(out);
            startRemoteCpProtocol(in, out, localFile);
        } finally {
            if (channel != null) {
View Full Code Here

        try {

            OutputStream out = channel.getOutputStream();
            InputStream in = channel.getInputStream();

            channel.connect();

            waitForAck(in);
            sendFileToRemote(localFile, in, out);
        } finally {
            if (channel != null) {
View Full Code Here

        Channel channel = openExecChannel("scp -d -t " + remotePath);
        try {
            OutputStream out = channel.getOutputStream();
            InputStream in = channel.getInputStream();

            channel.connect();

            waitForAck(in);
            for (Iterator i = directoryList.iterator(); i.hasNext();) {
                Directory current = (Directory) i.next();
                sendDirectory(current, in, out);
View Full Code Here

        try {
            // get I/O streams for remote scp
            OutputStream out = channel.getOutputStream();
            InputStream in = channel.getInputStream();

            channel.connect();

            sendAck(out);
            startRemoteCpProtocol(in, out, localFile);
        } finally {
            if (channel != null) {
View Full Code Here

    try {
      // @TODO: Fix so that this operation is generic and casting to
      // JschSession is no longer necessary.
      final Channel channel = ((JschSession) getSession())
          .getSftpChannel();
      channel.connect(tms);
      return (ChannelSftp) channel;
    } catch (JSchException je) {
      throw new TransportException(uri, je.getMessage(), je);
    }
  }
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.