Package at.molindo.esi4j.rebuild.util

Examples of at.molindo.esi4j.rebuild.util.BulkIndexHelper$Session


        }
       
        public Session openSession() throws IOException {
            lock(Thread.currentThread());
            try {
                Session session = myConnection.openSession();
                if (session != null) {
                    mySessionCount++;
                }
                SVNDebugLog.getDefaultLog().logFine(SVNLogType.NETWORK,
                        ourRequestor + ": SESSION OPENED: " + this + "." + mySessionCount);
View Full Code Here


   * @param source
   * @param destination
   * @throws IOException
   */
  public void copy(String source, String destination) throws IOException {
    Session sess = createSession();
    String serverDestPath = destination;
    SFTPv3DirectoryEntry pathEntry = getDirectoryEntry(destination);
    if (pathEntry.attributes.isRegularFile())
      serverDestPath = serverDestPath.substring(0, serverDestPath
          .lastIndexOf("/"));

    SFTPv3DirectoryEntry pathEntrySource = getDirectoryEntry(source);
    if (pathEntrySource.attributes.isDirectory())
      return;

    String copyCommand = JSimConstants.COPYSSH;
    copyCommand = copyCommand.replace("%1", source);
    copyCommand = copyCommand.replace("%2", serverDestPath);
    sess.execCommand(copyCommand);
    sess.close();
  }
View Full Code Here

   * Creates a SSH Session object
   * @return session object
   * @throws IOException
   */
  public Session createSession() throws IOException {
    Session sess = null;
    if (conn != null)
      sess = conn.openSession();
    return sess;
  }
View Full Code Here

        }
       
        public Session openSession() throws IOException {
            lock(Thread.currentThread());
            try {
                Session session = myConnection.openSession();
                if (session != null) {
                    mySessionCount++;
                }
                SVNDebugLog.getDefaultLog().logFine(SVNLogType.NETWORK,
                        ourRequestor + ": SESSION OPENED: " + this + "." + mySessionCount);
View Full Code Here

        }
       
        public Session openSession() throws IOException {
            lock(Thread.currentThread());
            try {
                Session session = myConnection.openSession();
                if (session != null) {
                    mySessionCount++;
                }
                SVNDebugLog.getDefaultLog().info(ourRequestor + ": SESSION OPENED: " + this + "." + mySessionCount);
                return session;
View Full Code Here

                    if (isAuthenticated == false) {
                        s_logger.info("Authentication failed");
                    }
                    //execute copy command
                    Session sess = conn.openSession();
                    String fileName;
                    Random ran = new Random();
                    fileName = Math.abs(ran.nextInt()) + "-file";
                    String copyCommand = new String("./scpScript " + vm.getPrivateIp() + " " + fileName);
                    s_logger.info("Executing " + copyCommand);
                    sess.execCommand(copyCommand);
                    Thread.sleep(120000);
                    sess.close();

                    //execute wget command
                    sess = conn.openSession();
                    String downloadCommand =
                        new String("wget http://172.16.0.220/scripts/checkDiskSpace.sh; chmod +x *sh; ./checkDiskSpace.sh; rm -rf checkDiskSpace.sh");
                    s_logger.info("Executing " + downloadCommand);
                    sess.execCommand(downloadCommand);
                    Thread.sleep(120000);
                    sess.close();

                    //close the connection
                    conn.close();
                }
            } catch (Exception ex) {
View Full Code Here

            if (i % 10 == 0)
                linuxCommand = "rm -rf *; wget http://192.168.1.250/dump.bin && ls -al dump.bin";
            else
                linuxCommand = "wget http://192.168.1.250/dump.bin && ls -al dump.bin";

            Session sess = conn.openSession();
            sess.execCommand(linuxCommand);

            InputStream stdout = sess.getStdout();
            InputStream stderr = sess.getStderr();

            byte[] buffer = new byte[8192];
            while (true) {
                if ((stdout.available() == 0) && (stderr.available() == 0)) {
                    int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA | ChannelCondition.EOF, 120000);

                    if ((conditions & ChannelCondition.TIMEOUT) != 0) {
                        s_logger.info("Timeout while waiting for data from peer.");
                        System.exit(2);
                    }

                    if ((conditions & ChannelCondition.EOF) != 0) {
                        if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
                            break;
                        }
                    }
                }

                while (stdout.available() > 0) {
                    success = true;
                    int len = stdout.read(buffer);
                    if (len > 0) // this check is somewhat paranoid
                        s_logger.info(new String(buffer, 0, len));
                }

                while (stderr.available() > 0) {
                    /* int len = */stderr.read(buffer);
                }
            }

            sess.close();
            conn.close();

            if (!success) {
                retry++;
                if (retry == MAX_RETRY_LINUX) {
View Full Code Here

                s_logger.info("Authentication failed for root with password" + password);
                System.exit(2);
            }

            String linuxCommand = "wget " + url;
            Session sess = conn.openSession();
            sess.execCommand(linuxCommand);
            sess.close();
            conn.close();

        } catch (Exception e) {
            s_logger.error("SSH test fail with error", e);
            System.exit(2);
View Full Code Here

                }
                SCPClient scp = new SCPClient(conn);

                scp.put("wget.exe", "");

                Session sess = conn.openSession();
                s_logger.info("Executing : wget http://172.16.0.220/dump.bin");
                sess.execCommand("wget http://172.16.0.220/dump.bin && dir dump.bin");

                InputStream stdout = sess.getStdout();
                InputStream stderr = sess.getStderr();

                byte[] buffer = new byte[8192];
                while (true) {
                    if ((stdout.available() == 0) && (stderr.available() == 0)) {
                        int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA | ChannelCondition.EOF, 120000);

                        if ((conditions & ChannelCondition.TIMEOUT) != 0) {
                            s_logger.info("Timeout while waiting for data from peer.");
                            return null;
                        }

                        if ((conditions & ChannelCondition.EOF) != 0) {
                            if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
                                break;
                            }
                        }
                    }

                    while (stdout.available() > 0) {
                        success = true;
                        int len = stdout.read(buffer);
                        if (len > 0) // this check is somewhat paranoid
                            s_logger.info(new String(buffer, 0, len));
                    }

                    while (stderr.available() > 0) {
                        int len = stderr.read(buffer);
                    }
                }
                sess.close();
                conn.close();

                if (success) {
                    return null;
                } else {
View Full Code Here

                if (isAuthenticated == false) {
                    return "Authentication failed";
                }
                boolean success = false;
                Session sess = conn.openSession();
                s_logger.info("Executing : wget http://172.16.0.220/dump.bin");
                sess.execCommand("wget http://172.16.0.220/dump.bin && ls -al dump.bin");

                InputStream stdout = sess.getStdout();
                InputStream stderr = sess.getStderr();

                byte[] buffer = new byte[8192];
                while (true) {
                    if ((stdout.available() == 0) && (stderr.available() == 0)) {
                        int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA | ChannelCondition.EOF, 120000);

                        if ((conditions & ChannelCondition.TIMEOUT) != 0) {
                            s_logger.info("Timeout while waiting for data from peer.");
                            return null;
                        }

                        if ((conditions & ChannelCondition.EOF) != 0) {
                            if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
                                break;
                            }
                        }
                    }

                    while (stdout.available() > 0) {
                        success = true;
                        int len = stdout.read(buffer);
                        if (len > 0) // this check is somewhat paranoid
                            s_logger.info(new String(buffer, 0, len));
                    }

                    while (stderr.available() > 0) {
                        int len = stderr.read(buffer);
                    }
                }

                sess.close();
                conn.close();

                if (success) {
                    return null;
                } else {
View Full Code Here

TOP

Related Classes of at.molindo.esi4j.rebuild.util.BulkIndexHelper$Session

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.