Package com.trilead.ssh2

Examples of com.trilead.ssh2.SFTPv3Client


      }

      this.getSshSession().execCommand(strCmd);

      logger.debug("output to stdout for remote command: " + strCmd);
      ipsStdOut = new StreamGobbler(this.getSshSession().getStdout());
      ipsStdErr = new StreamGobbler(this.getSshSession().getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(ipsStdOut));
      strbStdoutOutput = new StringBuffer();
      while (true) {
        String line = stdoutReader.readLine();
        if (line == null)
View Full Code Here


            spooler_log.debug5("executing remote command: " + command);
            this.setSshSession(this.getSshConnection().openSession());
            this.getSshSession().execCommand(command);

            spooler_log.debug5("output to stdout for remote command: " + command);
            InputStream stdout = new StreamGobbler(this.getSshSession().getStdout());
            BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
            while (true) {
                String line = stdoutReader.readLine();
                if (line == null) break;
                spooler_log.info(line);
            }

            spooler_log.debug5("output to stderr for remote command: " + command);
            InputStream stderr = new StreamGobbler(this.getSshSession().getStderr());
            BufferedReader stderrReader = new BufferedReader(new InputStreamReader(stderr));
            String stderrOutput = "";
            while (true) {
                String line = stderrReader.readLine();
                if (line == null) break;
View Full Code Here

      spooler_log.debug5("fetching children");
      this.getSshSession().execCommand("/bin/ps -ef");

      spooler_log.debug9("output to stdout for ps command: ");
      stdout = new StreamGobbler(this.getSshSession().getStdout());
      stderr = new StreamGobbler(this.getSshSession().getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
      String line = stdoutReader.readLine(); //Ueberschrift
      spooler_log.debug9(line);

View Full Code Here

  private void executeCommand(String command, int logLevel) throws Exception{
    Session session = getSshConnection().openSession();
    try{
      session.execCommand(command);
      spooler_log.log(logLevel,"output to stdout for remote command: " + command);
      stdout = new StreamGobbler(this.getSshSession().getStdout());
      stderr = new StreamGobbler(this.getSshSession().getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));

      while (true) {
        String line = stdoutReader.readLine();
        if (line == null) break;
View Full Code Here

            }

            this.getSshSession().execCommand(currentCommand);

            getLogger().debug("output to stdout for remote command: " + normalizedPassword(this.getCommands()[i]));
            stdout = new StreamGobbler(this.getSshSession().getStdout());
            stderr = new StreamGobbler(this.getSshSession().getStderr());
            BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
            int pid = 0;
            while (true) {
              String line = stdoutReader.readLine();
              if (line == null)
View Full Code Here

      session = this.getSshConnection().openSession();
      getLogger().debug9("Executing command " + checkShellCommand);
      session.execCommand(checkShellCommand);

      getLogger().debug9("output to stdout for remote command: " + checkShellCommand);
      stdout = new StreamGobbler(session.getStdout());
      stderr = new StreamGobbler(session.getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
      String stdOut = "";
      while (true) {
        String line = stdoutReader.readLine();
        if (line == null)
View Full Code Here

    }
    try {
      session = conn.openSession();
      final String path = uri.getPath();
      session.execCommand(String.format("hg -R %s serve --stdio", path.charAt(0) == '/' ? path.substring(1) : path));
      remoteErr = new StreamGobbler(session.getStderr());
      remoteOut = new StreamGobbler(session.getStdout());
      remoteIn = session.getStdin();
      sessionUse = 1;
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Failed to create ssh session", ex);
    }
View Full Code Here

      sess = startProcess(commands);

      OutputStuff ndxOutput = new OutputStuff();
      ndxOutput.output(sess.getStdin(), ndxCommands);

      InputStream stdout = new StreamGobbler(sess.getStdout());
      commandResult = new BufferedReader(new InputStreamReader(stdout));

      ndxCommands = GromacsCommandBuilder.getInstance()
          .createRenameGroupNdxCommand(commandResult, groupName);
View Full Code Here

    DataHandler handler = getHandler();
    handler.delete(commands.get(4));
  }

  private void outputStdout(InputStream stream) throws IOException {
    InputStream stdout = new StreamGobbler(stream);
    BufferedReader commandResult = new BufferedReader(
        new InputStreamReader(stdout));
    try {
      String s;
      while ((s = commandResult.readLine()) != null) {
View Full Code Here

    /**
     * Compresses a string into an integer with MD5.
     */
    private int md5(String s) {
        MD5 md5 = new MD5();
        md5.update(s.getBytes());
        byte[] digest = new byte[16];
        md5.digest(digest);

        // 16 bytes -> 4 bytes
        for (int i=0; i<4; i++)
            digest[i] ^= digest[i+4]+digest[i+8]+digest[i+12];
        return (b2i(digest[0])<< 24)|(b2i(digest[1])<<16)|(b2i(digest[2])<< 8)|b2i(digest[3]);
View Full Code Here

TOP

Related Classes of com.trilead.ssh2.SFTPv3Client

Copyright © 2018 www.massapicom. 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.