Class AlgorithmManager

java.lang.Object
org.episteme.core.technical.algorithm.AlgorithmManager

public final class AlgorithmManager extends Object
Universal manager for algorithm providers.

Discovery uses two converging paths:

  1. ServiceLoader<AlgorithmProvider> — direct SPI registration
  2. BackendDiscovery — via Backend.getAlgorithmProviders()
Results from both paths are merged, deduplicated, and sorted by priority.

Since:
1.2
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Details

    • setService

      public static void setService(AlgorithmService newService)
      Sets the AlgorithmService to use.
    • getService

      public static AlgorithmService getService()
      Gets the current AlgorithmService.
    • getProvider

      public static <P extends AlgorithmProvider> P getProvider(Class<P> providerClass)
      Finds and returns the best available provider for the given interface.
    • getProviders

      public static <P extends AlgorithmProvider> List<P> getProviders(Class<P> providerClass)
      Finds and returns all available providers for the given interface, sorted by priority.
    • getReferenceProvider

      public static <P extends AlgorithmProvider> P getReferenceProvider(Class<P> providerClass)
      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 throws UnsupportedOperationException.
    • getRegistry

      public static ProviderRegistry getRegistry()
      Returns the provider registry for operational selection.
    • isFiltered

      public static boolean isFiltered(String name)
      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.