Class HarvestSourceCatalog

java.lang.Object
org.javastro.ivoa.registry.internal.HarvestSourceCatalog

@ApplicationScoped public class HarvestSourceCatalog extends Object
Persistent catalog of known harvest sources, backed by a BaseX XML document at Registry/harvest/sources.xml.

An in-memory ConcurrentHashMap is kept in sync with BaseX so that hot-path reads never need a database round-trip. All mutating operations persist the full catalog document back to BaseX immediately. Serialization and deserialization are handled by JAXB.

  • Constructor Details

  • Method Details

    • init

      public void init()
      Idempotent initialisation. Creates the catalog document in BaseX if it does not yet exist, then loads any previously persisted sources into the in-memory cache.
    • upsert

      public HarvestSource upsert(HarvestSource source)
      Insert or update a source. If a source with the same sourceKey already exists its status, lastSeen, identifier, and oaiUrl fields are refreshed; provenance (discoveredFromSourceKey, depth, firstSeen) is preserved.
      Returns:
      the stored source (after merge)
    • get

      public Optional<HarvestSource> get(String sourceKey)
    • getAll

      public List<HarvestSource> getAll()
    • count

      public int count()
    • contains

      public boolean contains(String sourceKey)
    • updateStatus

      public void updateStatus(String sourceKey, SourceStatus status)
    • updateStatus

      public void updateStatus(String sourceKey, SourceStatus status, String rejectionReason)
    • updateLastAttempted

      public void updateLastAttempted(String sourceKey, Instant ts)
    • updateLastSuccessful

      public void updateLastSuccessful(String sourceKey, Instant ts)
    • appendRunRecord

      public void appendRunRecord(String sourceKey, HarvestRunRecord record)