Package com.google.enterprise.connector.instantiator

Examples of com.google.enterprise.connector.instantiator.Configuration


  // Test that checkpoints are not included in the output.
  public final void testWriteCheckpoint() {
    Schedule schedule =
        new Schedule("connector-02", false, 100, 300000, "0-0");
    ImportExportConnector connector = new LegacyImportExportConnector(
        "connector-02", new Configuration("TestConnector",
        ImportExportConnectorTest.CONFIG_MAP, null), schedule, "checkpoint");

    String xmlResult = ImportExportConnectorTest.asXmlString(connector);
    assertEquals(ImportExportConnectorTest.NEW_FORMAT_WITH_SCHEDULE,
        StringUtils.normalizeNewlines(xmlResult));
View Full Code Here


  // Test that schedules are written in exploded format.
  public final void testWriteSingleConnector() {
    Schedule schedule =
        new Schedule("connector-02", true, 100, 300000, "0-0");
    ImportExportConnector connector = new ImportExportConnector("connector-02",
        new Configuration("TestConnector", ImportExportConnectorTest.CONFIG_MAP,
        ImportExportConnectorTest.CONFIG_XML), schedule, "checkpoint");
    ImportExportConnectorList connectors = new ImportExportConnectorList();
    connectors.add(connector);

    String xmlResult = asXmlString(connectors);
View Full Code Here

        StringUtils.normalizeNewlines(xmlResult));
  }

  private final ImportExportConnectorList buildMultipleConnectors() {
    ImportExportConnector connector = new ImportExportConnector("connector-01",
        new Configuration("TestConnector", ImportExportConnectorTest.CONFIG_MAP,
        null), null, null);
    ImportExportConnectorList connectors = new ImportExportConnectorList();
    connectors.add(connector);

    Schedule schedule = new Schedule("connector-02", false, 100, 300000, "0-0");
    Map<String, String> config =
        new HashMap<String, String>(ImportExportConnectorTest.CONFIG_MAP);
    config.put("color", "blue");
    connector = new ImportExportConnector("connector-02",
        new Configuration("TestConnector", config, null), schedule, null);
    connectors.add(connector);
    return connectors;
  }
View Full Code Here

      if (connectorNames != null &&
          !connectorNames.contains(storeContext.getConnectorName())) {
        continue;
      }

      Configuration config =
          persistentStore.getConnectorConfiguration(storeContext);
      if (config != null) {
        // Strip the often transient google properties (such as google work dir).
        // Encrypt sensitive properties before including them in the output.
        // Note that the order of operations is important here.  We strip the
        // google* properties first, then encrypt passwords, which adds back a
        // googlePropertiesVersion - needed to decrypt the properties correctly.
        config = new Configuration(encryptSensitiveProperties(
            removeGoogleProperties(config.getMap())), config);
        // Try to determine the connector version.
        String typeVersion = null;
        if (manager != null) {
          try {
            typeVersion = JarUtils.getJarVersion(manager.getConnectorType(
                config.getTypeName()).getClass());
          } catch (ConnectorTypeNotFoundException ctnfe) {
            LOGGER.warning("Failed to locate ConnectorType for "
                           + config.getTypeName());
          }
        }

        // Add this connector to the list.
        connectors.add(new ImportExportConnector(
View Full Code Here

      configXml = XmlParseUtil.getCdata(configElement);
      if (configXml != null) {
        configXml = ServletUtil.restoreEndMarkers(configXml);
      }
    }
    return new Configuration(type, configMap, configXml);
  }
View Full Code Here

  @Override
  public ConnectorStatus getConnectorStatus(String connectorName)
      throws ConnectorNotFoundException {
    String connectorTypeName = instantiator.getConnectorTypeName(connectorName);
    Schedule schedule = instantiator.getConnectorSchedule(connectorName);
    Configuration config = getConnectorConfiguration(connectorName);
    String globalNamespace = null;
    String localNamespace = null;
    if (config != null) {
      Map<String, String> configData = config.getMap();
      globalNamespace = configData.get(PropertiesUtils.GOOGLE_GLOBAL_NAMESPACE);
      localNamespace = configData.get(PropertiesUtils.GOOGLE_LOCAL_NAMESPACE);
    }
    // Note: We do not return a null or empty Schedule, as most GSAs cannot
    // handle it.
View Full Code Here

  // Test that schedules are written in exploded format.
  public final void testWriteExplodedSchedule() {
    Schedule schedule =
        new Schedule("connector-02", true, 100, 300000, "0-0");
    ImportExportConnector connector = new ImportExportConnector("connector-02",
        new Configuration("TestConnector", CONFIG_MAP, null), schedule, null);

    String xmlResult = asXmlString(connector);
    assertEquals(NEW_FORMAT_WITH_EXPLODED_SCHEDULE,
        StringUtils.normalizeNewlines(xmlResult));
  }
View Full Code Here

  // Test that checkpoints are included in the output.
  public final void testWriteCheckpoint() {
    Schedule schedule =
        new Schedule("connector-02", false, 100, 300000, "0-0");
    ImportExportConnector connector = new ImportExportConnector("connector-02",
        new Configuration("TestConnector", CONFIG_MAP, null),
        schedule, "checkpoint");

    String xmlResult = asXmlString(connector);
    System.out.println("testWriteCheckpoint:\n" + xmlResult);
    assertEquals(NEW_FORMAT_WITH_CHECKPOINT,
View Full Code Here

  static final ImportExportConnectorList getConnectors() {
    ImportExportConnectorList connectors = new ImportExportConnectorList();
    Instantiator instantiator = Context.getInstance().getInstantiator();
    for (String connectorName : instantiator.getConnectorNames()) {
      try {
        Configuration configuration =
            instantiator.getConnectorConfiguration(connectorName);
        if (configuration != null) {
          Schedule schedule = instantiator.getConnectorSchedule(connectorName);
          connectors.add(new LegacyImportExportConnector(
              connectorName, configuration, schedule, null));
View Full Code Here

    for (ImportExportConnector connector : connectors) {
      String name = connector.getName();
      try {
        // Store the Configuration.
        boolean update = previousConnectorNames.contains(name);
        Configuration configuration = connector.getConfiguration();
        ConfigureResponse configureResponse =
            instantiator.setConnectorConfiguration(name, configuration,
                                                   Locale.ENGLISH, update);
        if (configureResponse != null) {
          LOGGER.warning("setConnectorConfiguration(name=" + name + "\"): "
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.instantiator.Configuration

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.