Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.ConfigureResponse


    DctmConnectorType test = new DctmConnectorType();
    String[] fiels = { "login", "Password", "docbase", "clientX",
        "authentication_type", "webtop_display_url", "where_clause",
        "is_public" };
    test.setConfigKeys(fiels);
    ConfigureResponse resp = test.validateConfig(map, Locale.US, null);
    assertTrue(resp
        .getMessage()
        .startsWith(
            "<p><font color=\"#FF0000\">Some required configuration is missing: Please check the Webtop URL."));
  }
View Full Code Here


    DctmConnectorType test = new DctmConnectorType();
    String[] fiels = { "login", "Password", "docbase", "clientX",
        "authentication_type", "webtop_display_url", "where_clause",
        "is_public" };
    test.setConfigKeys(fiels);
    ConfigureResponse resp = test.validateConfig(map, Locale.US, null);
    assertTrue(resp
        .getMessage()
        .startsWith(
            "<p><font color=\"#FF0000\">Some required configuration is missing: Please make sure that the Webtop URL is correct and that the application server is up and running."));
  }
View Full Code Here

    DctmConnectorType test = new DctmConnectorType();
    String[] fiels = { "login", "Password", "docbase", "clientX",
        "authentication_type", "webtop_display_url", "where_clause",
        "is_public" };
    test.setConfigKeys(fiels);
    ConfigureResponse resp = test.validateConfig(map, Locale.US, null);
    assertTrue(resp
        .getMessage()
        .startsWith(
            "<p><font color=\"#FF0000\">Some required configuration is missing: The additional WHERE clause must start with the keyword AND. Please check the additional WHERE clause."));
  }
View Full Code Here

    DctmConnectorType test = new DctmConnectorType();
    String[] fiels = { "login", "Password", "docbase", "clientX",
        "authentication_type", "webtop_display_url", "where_clause",
        "is_public" };
    test.setConfigKeys(fiels);
    ConfigureResponse resp = test.validateConfig(map, Locale.US, null);
    assertTrue(resp
        .getMessage()
        .startsWith(
            "<p><font color=\"#FF0000\">Syntax error in DQL filter. You have specified an invalid property name."));
  }
View Full Code Here

    DctmConnectorType test = new DctmConnectorType();
    String[] fiels = { "login", "Password", "docbase", "clientX",
        "authentication_type", "webtop_display_url", "where_clause",
        "is_public" };
    test.setConfigKeys(fiels);
    ConfigureResponse resp = test.validateConfig(map, Locale.US, null);
    assertTrue(resp
        .getMessage()
        .startsWith(
            "<p><font color=\"#FF0000\">Syntax error in DQL filter. A parser error (syntax error) has occurred."));
  }
View Full Code Here

  @Override
  public ConfigureResponse getConfigForm(Locale language) {
    ResourceBundle resource = getResources(language);
    try {
      IClientX cl = getClientX();
      return new ConfigureResponse("",
          makeValidatedForm(null, resource, cl, null));
    } catch (RepositoryException e) {
      // If we can't connect to DFC at all, return just an error message.
      logger.log(Level.SEVERE,
          "Error while building the configuration form", e);
View Full Code Here

        // checked and a JavaScript action submitted the form.
        if (configData.get(ADVANCEDCONF).equals("on")
            && configData.get(ACTIONUPDATE).equals("redisplay")) {
          logger.config("Redisplay the configuation form");
          String form = makeValidatedForm(configData, resource, cl, sess);
          return new ConfigureResponse("", form);
        }

        checkWhereClause(configData, cl, sess, connectorFactory);
      } catch (RepositoryException e) {
        logger.log(Level.SEVERE,
            "RepositoryException thrown in validateConfig: ", e);

        if (!isCoreConfigValid) {
          // If there's a problem with the core configuration, we will
          // turn the advanced configuration off until the user fixes
          // the problem.
          configData.put(ADVANCEDCONF, "off");
          logger.config("ADVANCEDCONF reset to off");
        }

        if (cl == null) {
          // If we can't connect to DFC at all, return just an error message.
          return createErrorResponse(e, resource, ErrorStyle.VALIDATE_CONFIG);
        }

        // Return the config form with an error message.
        return createErrorResponse(configData, e, resource, cl, sess,
            ErrorStyle.VALIDATE_CONFIG);
      } finally {
        if (sess != null) {
          sessMag.release(sess);
          logger.fine("Release sessionConfig");
        }
      }

      // There's no need to persist action_update.
      configData.remove(ACTIONUPDATE);

      return null;
    } else {
      if (!missing.equals(DISPLAYURL)) {
        // If there's a problem with the core configuration, we will
        // turn the advanced configuration off until the user fixes
        // the problem.
        configData.put(ADVANCEDCONF, "off");
        logger.config("ADVANCEDCONF reset to off");
      }

      // Return the config form with an error message indicating the
      // name of the missing parameter.
      String form;
      try {
        IClientX cl = getClientX();
        form = makeValidatedForm(configData, resource, cl, null);
      } catch (RepositoryException e) {
        form = "";
      }
      return new ConfigureResponse(resource.getString(missing + "_error"),
          form);
    }
  }
View Full Code Here

  @Override
  public ConfigureResponse getPopulatedConfigForm(
      Map<String, String> configMap, Locale language) {
    logger.fine("getPopulatedConfigForm");
    ResourceBundle resource = getResources(language);
    ConfigureResponse result = null;

    // We use the session here to validate the username, password, and
    // docbase. We will also need it later in makeValidatedForm if the
    // advanced config is turned on.
    IClientX cl = null;
    ISessionManager sessMag = null;
    ISession sess = null;
    try {
      cl = getClientX();
      sessMag = getSessionManager(cl, configMap);
      sess = getSession(configMap, sessMag);

      for (String key : configKeys) {
        String val = configMap.get(key);
        if (val == null) {
          if (key.equals(ADVANCEDCONF)) {
            val = "off";
          } else if (key.equals(ACTIONUPDATE)) {
            val = "";
          } else if (key.equals(ROOT_OBJECT_TYPE) && val == null) {
            val = rootObjectType;
          } else if (key.equals(INCLUDED_OBJECT_TYPE)) {
            val = includedObjectType;
          } else if (key.equals(INCLUDED_META)) {
            val = includedMeta;
          } else {
            continue;
          }
          logger.config(key + " was null; set to " + val);
          configMap.put(key, val);
        }
      }

      if (logger.isLoggable(Level.CONFIG)) {
        logger.config("Before spring process: " + getMaskedMap(configMap));
      }

      result = new ConfigureResponse("",
          makeValidatedForm(configMap, resource, cl, sess));
    } catch (RepositoryException e) {
      logger.log(Level.WARNING, "Error building the configuration form", e);

      if (cl == null) {
View Full Code Here

    if (style == ErrorStyle.GET_CONFIG_FORM) {
        form = "<font color='red'>" + bundleMessage + "</font><br />\n"
            + form;
        bundleMessage = "";
    }
    return new ConfigureResponse(bundleMessage, form);
  }
View Full Code Here

    assertContains(response.getMessage(), message);
    assertEquals(form, response.getFormSnippet());
  }

  public void testGcf() {
    ConfigureResponse response = type.getConfigForm(Locale.US);
    assertIsNotError(response);
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.ConfigureResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.