Пример #1
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;
  }
  /*
   * For remote application server instance, set
   * STR_SAVE_REMOTE_AGENT_INSTALL_DIR_KEY as new agent's install directory
   * after unconfigure, so other install tasks will use the new one.
   */
  protected void postUnconfigureTasks(IStateAccess stateAccess) {

    String remoteHomeDir = getRemoteHomeDir(stateAccess);
    if (remoteHomeDir == null) {
      return;
    }

    String migrateRemoteHomeDir =
        (String) stateAccess.get(STR_MIGRATE_REMOTE_AGENT_INSTALL_DIR_KEY);
    if (migrateRemoteHomeDir != null && migrateRemoteHomeDir.length() > 0) {
      stateAccess.put(STR_REMOTE_AGENT_INSTALL_DIR_KEY, migrateRemoteHomeDir);
    }

    String migrateRemoteAgentName = (String) stateAccess.get(STR_MIGRATE_AGENT_INSTANCE_NAME_KEY);
    if (migrateRemoteAgentName != null && migrateRemoteAgentName.length() > 0) {
      stateAccess.put(STR_AGENT_INSTANCE_NAME_KEY, migrateRemoteAgentName);
    }
  }
  /*
   * If any, get previous agent's install directory for remote appserver
   * instance.
   */
  private String getRemoteHomeDir(IStateAccess stateAccess) {

    String remoteHomeDir = (String) stateAccess.get(STR_REMOTE_AGENT_INSTALL_DIR_KEY);
    if (remoteHomeDir == null || remoteHomeDir.length() == 0) {
      return null;
    } else {
      return remoteHomeDir;
    }
  }
Пример #4
0
  private boolean skipTask(IStateAccess stateAccess) {
    boolean result = false;
    String isRemote = (String) stateAccess.get(STR_DAS_HOST_IS_REMOTE_KEY);

    if (isRemote != null) {
      result = Boolean.valueOf(isRemote).booleanValue();
      Debug.log("ConfigureDomainXMLTask: skipTask = " + isRemote);
    }

    return result;
  }
Пример #5
0
 protected boolean removeAgentAppWar(IStateAccess stateAccess) {
   boolean status = false;
   String destDir = (String) stateAccess.get(STR_KEY_JETTY_INST_DEPLOY_DIR);
   String agentAppWar = destDir + STR_FORWARD_SLASH + STR_AGENT_APP_WAR_FILE;
   try {
     File file = new File(agentAppWar);
     status = file.delete();
     Debug.log("ConfigureAgentAppTask.removeAgentAppWar(): " + " Removed file " + agentAppWar);
   } catch (Exception e) {
     Debug.log(
         "ConfigureAgentAppTask.removeAgentAppWar(): " + " Failed to remove file " + agentAppWar,
         e);
   }
   return status;
 }
  /*
   * For remote application server instance, set
   * STR_SAVE_REMOTE_AGENT_INSTALL_DIR_KEY
   * as previous agent's install directory before unconfigure.
   */
  protected void preUnconfigureTasks(IStateAccess stateAccess) {

    String remoteHomeDir = getRemoteHomeDir(stateAccess);
    if (remoteHomeDir == null) {
      return;
    }

    String saveRemoteHomeDir = (String) stateAccess.get(STR_SAVE_REMOTE_AGENT_INSTALL_DIR_KEY);
    if (saveRemoteHomeDir != null && saveRemoteHomeDir.length() > 0) {
      stateAccess.put(STR_REMOTE_AGENT_INSTALL_DIR_KEY, saveRemoteHomeDir);
    } else {
      stateAccess.put(STR_SAVE_REMOTE_AGENT_INSTALL_DIR_KEY, remoteHomeDir);
    }

    String remoteAgentName = (String) stateAccess.get(STR_AGENT_INSTANCE_NAME_KEY);
    String saveAgentName = (String) stateAccess.get(STR_SAVE_AGENT_INSTANCE_NAME_KEY);
    if (saveAgentName != null && saveAgentName.length() > 0) {
      stateAccess.put(STR_AGENT_INSTANCE_NAME_KEY, saveAgentName);
    } else {
      stateAccess.put(STR_SAVE_AGENT_INSTANCE_NAME_KEY, remoteAgentName);
    }
  }