/**
   * Returns the product home directory if the locator file is present or returns null. If null =>
   * first time install
   *
   * @return the product home directory
   * @throws InstallException
   */
  protected String getProductHome(IStateAccess stateAccess) throws InstallException {
    String serverHomeDir = getServerHomeDir(stateAccess);
    setProductLocatorFile(serverHomeDir + FILE_SEP + STR_LOCATOR_FILE_NAME);

    String productHome = null;
    File file = new File(getProductLocatorFile());
    if (file.exists() && file.canRead()) {
      // Found old install
      productHome = readProductHome();
      validateProductHome(productHome, getProductLocatorFile());

      if (!productHome.equals(ConfigUtil.getHomePath())) {
        Debug.log(
            "MigrateServerLocatorHandler.validateProductHome() : "
                + "old Product home: "
                + productHome
                + ", New Product Home: "
                + ConfigUtil.getHomePath());

      } else {
        Debug.log("MigrateServerLocatorHandler - Error:" + "This agent has been already migrated!");

        throw new InstallException(LocalizedMessage.get(LOC_DR_ERR_PRODUCT_ALREADY_MIGRATED));
      }
    }

    return productHome;
  }
Exemplo n.º 2
0
  protected boolean copyAgentAppWarFile(IStateAccess stateAccess) {
    boolean status = false;
    String srcDir = ConfigUtil.getEtcDirPath();
    String destDir = (String) stateAccess.get(STR_KEY_JETTY_INST_DEPLOY_DIR);

    try {
      FileUtils.copyJarFile(srcDir, destDir, STR_AGENT_APP_WAR_FILE);
      Debug.log(
          "ConfigureAgentAppTask.copyAgentAppWarFile() - copy "
              + STR_AGENT_APP_WAR_FILE
              + " from "
              + srcDir
              + " to "
              + destDir);
      status = true;
    } catch (Exception e) {
      Debug.log(
          "ConfigureAgentAppTask."
              + "copyAgentAppWarFile() - Error occured while copying "
              + STR_AGENT_APP_WAR_FILE
              + " from "
              + srcDir
              + " to "
              + destDir,
          e);
    }
    return status;
  }