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;
  }