All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.byu.hbll.box.ReadOnlyDatabase Maven / Gradle / Ivy

There is a newer version: 2.5.3
Show newest version
package edu.byu.hbll.box;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.time.Duration;
import java.time.Instant;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;

/**
 * Implements all write-methods as no-ops for use as a read-only database.
 *
 * @author Charles Draper
 */
public interface ReadOnlyDatabase extends BoxDatabase {

  @Override
  default int addToQueue(Duration olderThan) {
    return 0;
  }

  @Override
  default void addToQueue(Collection ids, Instant attempt, boolean overwrite) {}

  @Override
  default void addToQueue(Collection elements) {}

  @Override
  default void clear() {
    throw new UnsupportedOperationException("unable to clear a read-only database");
  }

  @Override
  default void deleteFromQueue(Collection id) {}

  @Override
  default ObjectNode getHarvestCursor() {
    return null;
  }

  @Override
  default Set listSourceDependencies() {
    return Collections.emptySet();
  }

  @Override
  default List nextFromQueue(int limit) {
    return Collections.emptyList();
  }

  @Override
  default void processOrphans(String groupId, Consumer function) {}

  @Override
  default void removeDeleted(Duration olderThan) {}

  @Override
  default void save(Collection resultDocument) {}

  @Override
  default void setHarvestCursor(ObjectNode cursor) {}

  @Override
  default void startGroup(String groupId) {}

  @Override
  default void updateProcessed(Collection id) {}

  @Override
  default Map> findDependents(Collection dependencies) {
    return Collections.emptyMap();
  }

  @Override
  default Map> findDependencies(Collection ids) {
    return Collections.emptyMap();
  }

  @Override
  default JsonNode findRegistryValue(String id) {
    return null;
  }

  @Override
  default void saveRegistryValue(String id, JsonNode data) {}

  @Override
  default void updateDependencies(Collection documents) {}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy