Package com.google.enterprise.connector.scheduler

Examples of com.google.enterprise.connector.scheduler.Schedule


      resetBatch();                               // Halt any traversal.
      getInstanceInfo().setConnectorState(null)// Discard the checkpoint.

      // If Schedule was 'run-once', re-enable it to run again.  But watch out -
      // empty disabled Schedules could look a bit like a run-once Schedule.
      Schedule schedule = getInstanceInfo().getConnectorSchedule();
      if (schedule != null && schedule.isDisabled() &&
            schedule.getRetryDelayMillis() == -1 &&
            schedule.nextScheduledInterval() != -1) {
          schedule.setDisabled(false);
          getInstanceInfo().setConnectorSchedule(schedule);
      }
    }

    // TODO: Remove this if we switch completely to JDBC PersistentStore.
View Full Code Here


        traversalDelayEnd = 0// No delay.
        break;

      case POLL:
        try {
          Schedule schedule = getSchedule();
          int retryDelayMillis = schedule.getRetryDelayMillis();
          if (retryDelayMillis == Schedule.POLLING_DISABLED) {
            if (!schedule.isDisabled()) {
              // We reached then end of the repository, but aren't allowed
              // to poll looking for new content to arrive.  Disable the
              // traversal schedule.
              traversalDelayEnd = 0;
              schedule.setDisabled(true);
              // To avoid deadlock, this method calls InstanceInfo's setter,
              // rather than the local one.
              traversalSchedule = schedule; // Update local cache.
              getInstanceInfo().setConnectorSchedule(schedule);
              LOGGER.info("Traversal complete. Automatically pausing "
View Full Code Here

  }

  /** Sets the Schedule for a connector instance and records the action. */
  private void setSchedule(String connectorName) {
    store.storeConnectorSchedule(new StoreContext(connectorName, "testType"),
                                 new Schedule());
    expectedChanges.add(MockChangeListener.SCHEDULE_CHANGED + connectorName);
  }
View Full Code Here

    ConnectorCoordinator coordinator = ccm.get("connector-01");
    Configuration config = coordinator.getConnectorConfiguration();
    assertEquals("type", "TestConnectorA", config.getTypeName());
    ImportExportConnectorTest.assertContains(config.getMap(), "Color", "blue");
    assertEquals("checkpoint", "checkpoint", coordinator.getConnectorState());
    Schedule schedule = coordinator.getConnectorSchedule();
    assertFalse(schedule.isDisabled());
    assertTrue((schedule.getLoad() == 100));
    assertTrue((schedule.getRetryDelayMillis() == 300000));
    assertEquals("0-0", schedule.getTimeIntervals());

    coordinator = ccm.get("connector-02");
    config = coordinator.getConnectorConfiguration();
    assertEquals("type", "TestConnectorA", config.getTypeName());
    ImportExportConnectorTest.assertContains(config.getMap(), "Color", "red");
    assertEquals("checkpoint", "checkpoint", coordinator.getConnectorState());
    schedule = coordinator.getConnectorSchedule();
    assertFalse(schedule.isDisabled());
    assertTrue((schedule.getLoad() == 100));
    assertTrue((schedule.getRetryDelayMillis() == 300000));
    assertEquals("0-0", schedule.getTimeIntervals());
  }
View Full Code Here

      configMap.put("password", password);
    }
    Configuration config = new Configuration("TestConnector", configMap, null);
    StoreContext context = new StoreContext(name, "TestConnector");
    pstore.storeConnectorConfiguration(context, config);
    Schedule schedule = new Schedule(name, false, 100, 300000, "0-0");
    pstore.storeConnectorSchedule(context, schedule);
    pstore.storeConnectorState(context, name + " checkpoint");
  }
View Full Code Here

        StringUtils.normalizeNewlines(xmlResult));
  }

  // Test that schedules are written in new format.
  public final void testWriteNewSchedule() {
    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, null);

    String xmlResult = ImportExportConnectorTest.asXmlString(connector);
View Full Code Here

        StringUtils.normalizeNewlines(xmlResult));
  }

  // 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);
View Full Code Here

    assertNull("checkpoint", connector.getCheckpoint());
  }

  // 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);
View Full Code Here

        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);
View Full Code Here

    int retryDelayMillis = (delayStr != null) ? Integer.parseInt(delayStr)
        : Schedule.defaultRetryDelayMillis();

    String timeIntervals = XmlParseUtil.getFirstElementByTagName(
        root, ServletUtil.XMLTAG_TIME_INTERVALS);
    Schedule schedule = new Schedule(connectorName, disabled, load,
        retryDelayMillis, timeIntervals);

    try {
      manager.setSchedule(connectorName, schedule.toString());
    } catch (ConnectorNotFoundException e) {
      status = new ConnectorMessageCode(
          ConnectorMessageCode.EXCEPTION_CONNECTOR_NOT_FOUND, connectorName);
      LOGGER.log(
          Level.WARNING, ServletUtil.LOG_EXCEPTION_CONNECTOR_NOT_FOUND, e);
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.scheduler.Schedule

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.