Пример #1
0
  private void updateServiceRegistration() {
    Registrar registrar = new Registrar();
    for (AppUpdate appUpdate : _installs) {
      if (appUpdate.isServiceApp()) {
        boolean success;
        String appName = appUpdate.getAppName();
        if (appUpdate.hasDeletions()) {
          try {
            success = registrar.remove(appName);
          } catch (IOException ioe) {
            success = false;
          }
          if (!success) {
            showWarning(
                "Service '"
                    + appName
                    + "' has been successfully "
                    + "removed, but\n"
                    + "failed to deregister from the YAWL Engine.");
          }
        } else if (appUpdate.hasDownloads()) {
          WebXmlReader webXml = new WebXmlReader(appName);
          String password = webXml.getContextParam("EngineLogonPassword");
          String mapping = webXml.getIBServletMapping();
          if (password != null) {
            String url = mapping == null ? null : "http://localhost:8080/" + appName + mapping;
            try {
              success = registrar.add(appName, password, url);
            } catch (IOException ioe) {
              success = false;
            }
          } else success = false;

          if (!success) {
            showWarning(
                "Service '"
                    + appName
                    + "' has been successfully "
                    + "added, but\n"
                    + "failed to register with the YAWL Engine.");
          }
        }
      }
    }
    registrar.disconnect();
  }