Esempio n. 1
0
  /**
   * Obtains the installation by reading the classpath of the running JVM to determine the location
   * of the jars and determine the installation root.
   *
   * @return Installation obtained by reading the classpath
   */
  public static Installation getLocal() {
    if (local == null) {

      // This allows testing of configuration components when the OpenDJ.jar
      // in the classpath does not necessarily point to the server's
      String installRoot = System.getProperty("org.opends.quicksetup.Root");
      String instanceRoot = System.getProperty("org.opends.quicksetup.instance");

      if (installRoot == null) {
        installRoot = Utils.getInstallPathFromClasspath();
      }
      if (instanceRoot == null) {
        instanceRoot = Utils.getInstancePathFromInstallPath(installRoot);
      }
      local = new Installation(installRoot, instanceRoot);
    }
    return local;
  }
Esempio n. 2
0
 /**
  * Creates a new directory in the history directory appropriate for backing up an installation
  * during an upgrade.
  *
  * @return File representing a new backup directory. The directory can be assumed to exist if this
  *     method returns cleanly.
  * @throws IOException if an error occurred creating the directory.
  */
 public File createHistoryBackupDirectory() throws IOException {
   File backupDirectory =
       new File(getHistoryDirectory(), Long.toString(System.currentTimeMillis()));
   if (backupDirectory.exists()) {
     backupDirectory.delete();
   }
   if (!backupDirectory.mkdirs()) {
     throw new IOException("failed to create history backup directory");
   }
   return backupDirectory;
 }