Package org.openbravo.utils

Examples of org.openbravo.utils.PropertiesManager


  @Override
  public void execute() throws BuildException {
    log4j.info("Checking Tomcat's JVM version...");

    final String jvmVersion = new ServerConnection().getCheck("jvm-version");
    final String minJvmVersion = new PropertiesManager().getProperty("jvm-version");

    final String msg = "Current Tomcat's JVM version: " + jvmVersion
        + " minimum required version: " + minJvmVersion;

    if (Version.compareVersion(jvmVersion, minJvmVersion) < 0)
View Full Code Here


    log4j.info("Checking tomcat version...");
    final String versionString = new ServerConnection().getCheck("server");
    if (!versionString.contains("Tomcat"))
      throw new BuildException("Server seems not to be Tomcat");
    final String version = Version.getVersion(versionString);
    final String minVersion = new PropertiesManager().getProperty("tomcat.version");
    final String msg = "Minimum Tomcat version: " + minVersion + ", current version: " + version;
    if (Version.compareVersion(version, minVersion) < 0)
      throw new BuildException(msg
          + "Tip: check http://wiki.openbravo.com/wiki/Development_Stack_Setup#Apache_Tomcat");
    else {
View Full Code Here

    final Runtime runtime = Runtime.getRuntime();
    final long maxCurrentMemory = runtime.maxMemory() / (1024 * 1024); // Memory
    // in
    // MB

    final long maxMemory = new Long(new PropertiesManager().getProperty("max.memory"));
    final String msg = "Current max ant's memory:" + maxCurrentMemory + "M, minimum required:"
        + maxMemory + "M";
    // check max memory +- 5%, because it is not accurate
    if (maxMemory > maxCurrentMemory * 1.05)
      throw new BuildException(msg
View Full Code Here

        st.close();
      } catch (final Exception e) {
        throw new BuildException(e.getMessage());
      }
      final String version = Version.getVersion(versionString);
      final String minVersion = new PropertiesManager().getProperty("db.ora.version");
      String msg = "Minimum required version: " + minVersion + ", current version " + version;
      if (Version.compareVersion(version, minVersion) < 0)
        throw new BuildException(msg
            + "\nTip: check http://wiki.openbravo.com/wiki/Development_Stack_Setup#Oracle");
      else {
        log4j.info(msg);
        log4j.info("Oracle version OK");
      }

      // check open_cursors
      log4j.info("Checking Oracle open cursors...");
      long openCursors = 0;
      try {
        st = connSystem
            .prepareStatement("SELECT value FROM v$parameter WHERE name ='open_cursors'");
        result = st.executeQuery();
        while (result.next()) {
          openCursors = new Long(result.getString(1));
        }
        result.close();
        st.close();
      } catch (final Exception e) {
        throw new BuildException(e.getMessage());
      }
      final long minOpenCursors = new Long(new PropertiesManager()
          .getProperty("db.ora.opencursors"));
      msg = "Minimum open cursors required: " + minOpenCursors + ", current open cursors "
          + openCursors;
      if (openCursors < minOpenCursors)
        throw new BuildException(msg
            + "\nTip: check http://wiki.openbravo.com/wiki/Development_Stack_Setup#Oracle");
      else {
        log4j.info(msg);
        log4j.info("Open cursors OK");
      }

      // check processes
      log4j.info("Checking Oracle open cursors...");
      long processes = 0;
      try {
        st = connSystem.prepareStatement("SELECT value FROM v$parameter WHERE name ='processes'");
        result = st.executeQuery();
        while (result.next()) {
          processes = new Long(result.getString(1));
        }
        result.close();
        st.close();
      } catch (final Exception e) {
        throw new BuildException(e.getMessage());
      }
      final long minProcesses = new Long(new PropertiesManager().getProperty("db.ora.processes"));
      msg = "Minimum open processes required: " + minProcesses + ", current processes " + processes;
      if (processes < minProcesses)
        throw new BuildException(msg
            + "\nTip: check http://wiki.openbravo.com/wiki/Development_Stack_Setup#Oracle");
      else {
        log4j.info(msg);
        log4j.info("Open cursors OK");
      }

      try {
        st = connSystem
            .prepareStatement("select value from nls_database_parameters where parameter='NLS_NCHAR_CHARACTERSET'");
        result = st.executeQuery();
        result.next();
        String nchar_charset = result.getString(1);
        if (nchar_charset.equals("AL16UTF16"))
          log4j.info("NCHAR charset encoding OK.");
        else {
          throw new BuildException("NCHAR charset encoding incorrect. Current encoding: "
              + nchar_charset + ". Required encoding: AL16UTF16");
        }
        result.close();
        st.close();
      } catch (final Exception e) {
        throw new BuildException(e.getMessage());
      }
    } else { // PostgreSQL
      // Check version
      log4j.info("Checking PostgreSQL version...");
      String version = "";
      try {
        st = connSystem
            .prepareStatement("SELECT setting FROM pg_settings WHERE name = 'server_version'");

        result = st.executeQuery();

        while (result.next()) {
          version = result.getString(1);
        }
        result.close();
        st.close();
      } catch (final Exception e) {
        throw new BuildException(e.getMessage());
      }

      String minVersion = new PropertiesManager().getProperty("db.pg.version");
      if (System.getProperty("os.name").equalsIgnoreCase("Windows"))
        minVersion = new PropertiesManager().getProperty("db.pg.windows.version");
      else
        minVersion = new PropertiesManager().getProperty("db.pg.version");

      final String msg = "Minimum required version: " + minVersion + ", current version " + version;
      if (Version.compareVersion(version, minVersion) < 0)
        throw new BuildException(msg
            + "\nTip: check http://wiki.openbravo.com/wiki/Development_Stack_Setup#PostgreSQL");
View Full Code Here

  @Override
  public void execute() throws BuildException {
    log4j.info("Checking tomcat's memory...");
    final long maxCurrentMemory = new Long(new ServerConnection().getCheck("memory"));
    final long MaxMemory = new Long(new PropertiesManager().getProperty("max.memory"));
    final String msg = "Current max memory in server:" + maxCurrentMemory + "M, minimum required:"
        + MaxMemory + "M";

    // check max memory +- 5%, because it is not accurate
    if (MaxMemory > maxCurrentMemory * 1.05)
 
View Full Code Here

TOP

Related Classes of org.openbravo.utils.PropertiesManager

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.