Class AlgorithmManager
java.lang.Object
org.episteme.core.technical.algorithm.AlgorithmManager
Universal manager for algorithm providers.
Discovery uses two converging paths:
ServiceLoader<AlgorithmProvider>— direct SPI registrationBackendDiscovery— viaBackend.getAlgorithmProviders()
- Since:
- 1.2
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionstatic <P extends AlgorithmProvider, R>
RexecuteWithFallback(Class<P> providerClass, Function<P, R> operation) Executes an operation using the best available provider, automatically falling back to the next provider if the current one throwsUnsupportedOperationException.static <P extends AlgorithmProvider>
PgetNextProvider(Class<P> providerClass, AlgorithmProvider current) Finds and returns the next-best available provider after the given one.static <P extends AlgorithmProvider>
PgetProvider(Class<P> providerClass) Finds and returns the best available provider for the given interface.static <P extends AlgorithmProvider>
List<P> getProviders(Class<P> providerClass) Finds and returns all available providers for the given interface, sorted by priority.static <P extends AlgorithmProvider>
PgetReferenceProvider(Class<P> providerClass) Finds and returns the reference (baseline) provider for the given interface.static ProviderRegistryReturns the provider registry for operational selection.static AlgorithmServiceGets the current AlgorithmService.static booleanisFiltered(String name) Checks if a provider with the given name is filtered out by global configuration.static voidrefresh()Forces a refresh of the discovered providers.static voidsetService(AlgorithmService newService) Sets the AlgorithmService to use.static voidshutdown()Shuts down all discovered backends and providers.
-
Method Details
-
setService
Sets the AlgorithmService to use. -
getService
Gets the current AlgorithmService. -
getProvider
Finds and returns the best available provider for the given interface. -
getProviders
Finds and returns all available providers for the given interface, sorted by priority. -
getReferenceProvider
Finds and returns the reference (baseline) provider for the given interface. -
getNextProvider
public static <P extends AlgorithmProvider> P getNextProvider(Class<P> providerClass, AlgorithmProvider current) Finds and returns the next-best available provider after the given one. -
executeWithFallback
public static <P extends AlgorithmProvider, R> R executeWithFallback(Class<P> providerClass, Function<P, R> operation) Executes an operation using the best available provider, automatically falling back to the next provider if the current one throwsUnsupportedOperationException. -
getRegistry
Returns the provider registry for operational selection. -
isFiltered
Checks if a provider with the given name is filtered out by global configuration. -
refresh
public static void refresh()Forces a refresh of the discovered providers. -
shutdown
public static void shutdown()Shuts down all discovered backends and providers.
-