public final class InMemoryCatalogProvider extends Object implements CatalogProvider
CatalogProvider implementation for tests, demos, and the in-memory
fixture path. Backed by an InMemoryCatalogSnapshot.
Plan §6 / §7.2. snapshot(CatalogQuery) ignores the query's narrowing
options — the in-memory snapshot is fully materialized — and returns the same instance
on every call until close() is invoked. refresh(CatalogQuery) forwards
to the seed CatalogProviderConfig when present (the eager case) or returns the
existing snapshot (the test-fixture case).
Lifecycle: open(CatalogProviderConfig) accepts a config carrying a
"snapshot" property whose value is the CatalogSnapshot to serve;
alternatively, a snapshot can be installed at construction time via
InMemoryCatalogProvider(CatalogSnapshot).
| Modifier and Type | Class and Description |
|---|---|
static class |
InMemoryCatalogProvider.Factory
ServiceLoader-discoverable factory.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_SNAPSHOT
Property key used by
open(CatalogProviderConfig) to receive the seed snapshot. |
| Constructor and Description |
|---|
InMemoryCatalogProvider() |
InMemoryCatalogProvider(CatalogSnapshot snapshot) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
CatalogProviderId |
id() |
void |
open(CatalogProviderConfig config) |
CatalogSnapshot |
refresh(CatalogQuery query)
Force a fresh fetch bypassing any internal caches.
|
CatalogSnapshot |
snapshot(CatalogQuery query) |
public static final String CONFIG_SNAPSHOT
open(CatalogProviderConfig) to receive the seed snapshot.public InMemoryCatalogProvider()
public InMemoryCatalogProvider(CatalogSnapshot snapshot)
public CatalogProviderId id()
id in interface CatalogProviderpublic void open(CatalogProviderConfig config) throws CatalogException
open in interface CatalogProviderCatalogExceptionpublic CatalogSnapshot snapshot(CatalogQuery query) throws CatalogException
snapshot in interface CatalogProviderCatalogExceptionpublic CatalogSnapshot refresh(CatalogQuery query) throws CatalogException
CatalogProviderrefresh in interface CatalogProviderCatalogExceptionpublic void close() throws CatalogException
close in interface CatalogProviderclose in interface AutoCloseableCatalogException