public void refresh() {

    Properties props = getWebAppsProperties();
    props.forEach(
        (k, v) -> {
          File f = new File((String) v);
          Project p = FileOwnerQuery.getOwner(FileUtil.toFileObject(f));
          WebModule wm = WebModule.getWebModule(p.getProjectDirectory());
          String cp = wm.getContextPath();
        });
  }
  public BaseDeployProgressObject redeploy(
      BaseTargetModuleID oldModule, boolean completeImmediately) {
    command = "redeploy";
    BaseTarget target = getManager().getDefaultTarget();
    FileObject projDir = FileUtil.toFileObject(new File(oldModule.getProjectDir()));

    String contextPath = WebModule.getWebModule(projDir).getContextPath();
    BaseTargetModuleID newModule =
        BaseTargetModuleID.getInstance(getManager(), target, contextPath, projDir.getPath());

    this.setOldTargetModuleID(oldModule);
    this.setTargetModuleID(newModule);
    setCompleteImmediately(completeImmediately);
    setMode(getManager().getCurrentDeploymentMode());
    fireRunning(CommandType.REDEPLOY, getManager().getDefaultTarget().getName());
    RP.post(this, 0, Thread.NORM_PRIORITY);
    return this;
  }
  public void register(Project webApp) {
    int result = SUCCESS;

    Path target = createRegistry();

    if (target == null) {
      return;
    }
    FileObject propsFo =
        FileUtil.toFileObject(target.toFile())
            .getFileObject(SuiteConstants.SERVER_INSTANCE_WEB_APPS_PROPS);
    Properties props = new Properties();
    if (propsFo != null) {
      props = BaseUtil.loadProperties(propsFo);
      try {
        propsFo.delete();
      } catch (IOException ex) {
        LOG.log(Level.INFO, ex.getMessage());
      }
    }

    WebModule wm = WebModule.getWebModule(webApp.getProjectDirectory());

    String cp = wm.getContextPath();

    if (cp != null) {
      props.setProperty(cp, webApp.getProjectDirectory().getPath());
    } else {
      result = CONTEXTPATH_NOT_FOUND;
    }
    if (result == SUCCESS) {
      BaseUtil.storeProperties(
          props,
          FileUtil.toFileObject(target.toFile()),
          SuiteConstants.SERVER_INSTANCE_WEB_APPS_PROPS);
      String uri = SuiteManager.getManager(serverInstance).getUri();
      SuiteNotifier sn =
          SuiteManager.getServerSuiteProject(uri).getLookup().lookup(SuiteNotifier.class);
      sn.childrenChanged(this, webApp);
    }
    return;
  }
  public int unregister(Project webApp) {
    int result = SUCCESS;
    Path serverDir = Paths.get(serverInstance.getProjectDirectory().getPath());
    String root = serverDir.getRoot().toString().replaceAll(":", "_");
    if (root.startsWith("/")) {
      root = root.substring(1);
    }
    Path targetPath = serverDir.getRoot().relativize(serverDir);
    String tmp = System.getProperty("java.io.tmpdir");

    Path target = Paths.get(tmp, SuiteConstants.TMP_DIST_WEB_APPS, root, targetPath.toString());

    File file = target.toFile();
    if (!file.exists()) {
      try {
        FileUtil.createFolder(file);
      } catch (IOException ex) {
        result = CREATE_FOLDER_ERROR;
        LOG.log(Level.INFO, ex.getMessage());
      }
    }

    FileObject propsFo =
        FileUtil.toFileObject(target.toFile())
            .getFileObject(SuiteConstants.SERVER_INSTANCE_WEB_APPS_PROPS);
    Properties props = new Properties();
    if (propsFo != null) {
      props = BaseUtil.loadProperties(propsFo);
      try {
        propsFo.delete();
      } catch (IOException ex) {
        result = CREATE_FOLDER_ERROR;
        LOG.log(Level.INFO, ex.getMessage());
      }
    }

    WebModule wm = WebModule.getWebModule(webApp.getProjectDirectory());

    String cp = wm.getContextPath();

    if (cp != null) {
      props.remove(cp);
      FileObject targetFo = FileUtil.toFileObject(target.toFile());
    } else {
      result = CONTEXTPATH_NOT_FOUND;
    }
    if (result == SUCCESS) {
      BaseUtil.storeProperties(
          props,
          FileUtil.toFileObject(target.toFile()),
          SuiteConstants.SERVER_INSTANCE_WEB_APPS_PROPS);
      String uri = SuiteManager.getManager(serverInstance).getUri();
      Project suite = SuiteManager.getServerSuiteProject(uri);
      if (suite == null) {
        result = NOT_A_SUITE;
      } else {
        SuiteNotifier sn = suite.getLookup().lookup(SuiteNotifier.class);
        sn.childrenChanged(this, webApp);
      }
    }
    return result;
  }