Class HarvestOrchestrator
java.lang.Object
org.javastro.ivoa.registry.harvesting.HarvestOrchestrator
Queue-based orchestrator for asynchronous incremental harvesting of IVOA registries.
Architecture
- The RofR seed source is enrolled at first scheduler invocation.
- Each scheduler tick dequeues one pending source, harvests it
incrementally (using the per-source
lastSuccessfulUntilcursor), stores the records, and parses them to find new sources. - Newly discovered sources are enqueued through the same queue.
- The queue is deduplicated: a source that is already
QUEUEDorRUNNINGis never enqueued twice. - All source state is persisted in BaseX via
HarvestSourceCatalogand survives service restart.
Scheduling is controlled by the ivoa.harvesting.rofr.cron property
(default "off" = disabled). Set it to a cron expression such as
"0 0/10 * * * ?" to enable periodic harvesting.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordSnapshot of the harvesting queue and source catalog state. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleandiscoverNewSources(List<org.javastro.ivoa.entities.resource.Resource> resources, String fromSourceKey, int parentDepth, HarvestSourceCatalog catalog) Inspect the list of harvested resources and register any newly discovered harvestable registries incatalog.booleanEnqueue a specific source for harvesting.Returns recent run records from all sources (most-recent first, bounded).Returns all sources in the catalog.Returns a snapshot of the current harvest status.intloadFromCache(String sourceKey) Load the cached chunk files of a source into the registry store as a single document atharvested/<source-key>/rec.xml, replacing any existing one.booleanresetSource(String key) booleansetSourceStatus(String sourceKey, SourceStatus status) Set the status of a source (e.g.inttriggerHarvest(String sourceKey) Trigger an immediate, synchronous harvest of the seed (or a specific source).
-
Constructor Details
-
HarvestOrchestrator
public HarvestOrchestrator()
-
-
Method Details
-
enqueue
Enqueue a specific source for harvesting.- Parameters:
sourceKey- the key of a known source- Returns:
trueif the source was enqueued;falseif it was already queued/running, unknown, disabled, or rejected.
-
cache
-
loadFromCache
Load the cached chunk files of a source into the registry store as a single document atharvested/<source-key>/rec.xml, replacing any existing one.- Parameters:
sourceKey- the source key- Returns:
- number of records stored
-
triggerHarvest
Trigger an immediate, synchronous harvest of the seed (or a specific source).- Parameters:
sourceKey- seed is used whennull- Returns:
- number of records stored
-
getStatus
Returns a snapshot of the current harvest status. -
getSources
Returns all sources in the catalog. -
getRecentRuns
Returns recent run records from all sources (most-recent first, bounded). -
setSourceStatus
Set the status of a source (e.g. toSourceStatus.DISABLED).- Returns:
trueif the source was found,falseotherwise.
-
addSource
-
discoverNewSources
public List<String> discoverNewSources(List<org.javastro.ivoa.entities.resource.Resource> resources, String fromSourceKey, int parentDepth, HarvestSourceCatalog catalog) Inspect the list of harvested resources and register any newly discovered harvestable registries incatalog.- Parameters:
resources- records returned by a harvest runfromSourceKey- the source key that produced these records (for provenance)parentDepth- discovery depth of the producing sourcecatalog- the catalog to register new sources into- Returns:
- keys of sources that were newly accepted
-
resetSource
-