Class ServiceLoader<T>

java.lang.Object
overit.geocall.platform.sp.ServiceLoader<T>
Type Parameters:
T - provider's type

public class ServiceLoader<T> extends Object
A facility to load the instances of a specific service provider (Layer, UINode, CustomPackage, ...).

A service can be a well-known interface or class for which zero, one, or many service providers exist (see the SPI definitions). Alternatively a service can be a simple POJO annotated with some specific annotations like jakarta.ws.rs.Path, Filter, Platform.Event or Platform.Substitute.

Service providers are loaded and instantiated lazily, that is, on demand. A service loader maintains a cache of the providers that have been loaded so far. Each invocation of the load method returns an Iterable that first yields all the elements cached from previous iteration, in instantiation order, and then lazily locates and instantiates any remaining providers, adding each one to the cache in turn. Caches are cleared via the reload method.

  • Field Details

  • Method Details

    • layers

      public static ServiceLoader<Layer> layers()
      Utility method to get the instance of the service provider responsible to get the Layer instances
      Returns:
      the service provider to get the Layer instances
    • components

      public static ServiceLoader<UINode> components()
      Utility method to get the instance of the service provider responsible to get the UINode instances
      Returns:
      the service provider to get the UINode instances
    • customPackages

      public static ServiceLoader<CustomPackage> customPackages()
      Utility method to get the instance of the service provider responsible to get the CustomPackage instances
      Returns:
      the service provider to get the CustomPackage instances
    • scriptPackages

      public static ServiceLoader<ScriptPackage> scriptPackages()
      Utility method to get the instance of the service provider responsible to get the ScriptPackage instances
      Returns:
      the service provider to get the ScriptPackage instances
    • themePackages

      public static ServiceLoader<ThemePackage> themePackages()
      Utility method to get the instance of the service provider responsible to get the ThemePackage instances
      Returns:
      the service provider to get the ThemePackage instances
    • langPackages

      public static ServiceLoader<LangPackage> langPackages()
      Utility method to get the instance of the service provider responsible to get the LangPackage instances
      Returns:
      the service provider to get the LangPackage instances
    • permissions

      public static ServiceLoader<Permissions> permissions()
      Utility method to get the instance of the service provider responsible to get the Permissions instances
      Returns:
      the service provider to get the Permissions instances
    • grants

      public static ServiceLoader<Grants> grants()
      Utility method to get the instance of the service provider responsible to get the Grants instances
      Returns:
      the service provider to get the Grants instances
    • landings

      public static ServiceLoader<Landing> landings()
      Utility method to get the instance of the service provider responsible to get the Landing instances
      Returns:
      the service provider to get the Landing instances
    • landingTrees

      public static ServiceLoader<LandingTree> landingTrees()
      Utility method to get the instance of the service provider responsible to get the LandingTree instances
      Returns:
      the service provider to get the LandingTree instances
    • servlets

      public static ServiceLoader<Servlet> servlets()
      Utility method to get the instance of the service provider responsible to get the Servlet instances
      Returns:
      the service provider to get the Servlet instances
    • filters

      public static ServiceLoader<Filter> filters()
      Utility method to get the instance of the service provider responsible to get the Filter instances
      Returns:
      the service provider to get the Filter instances
    • webListeners

      public static ServiceLoader<EventListener> webListeners()
      Utility method to get the instance of the service provider responsible to get the EventListener instances
      Returns:
      the service provider to get the EventListener instances
    • restServices

      public static ServiceLoader<Object> restServices()
      Utility method to get the instance of the service provider responsible to get the JAX-RS resources
      Returns:
      the service provider to get the JAX-RS resources
    • restProviders

      public static ServiceLoader<Object> restProviders()
      Utility method to get the instance of the service provider responsible to get the JAX-RS providers
      Returns:
      the service provider to get the JAX-RS providers
    • substitutions

      public static ServiceLoader<Object> substitutions()
      Utility method to get the instance of the service provider responsible to get the classes substitutions
      Returns:
      the service provider to get the substitutions
    • events

      public static ServiceLoader<Object> events()
      Utility method to get the instance of the service provider responsible to get the handler of the Platform.Event
      Returns:
      the service provider to get the event handlers
    • spouts

      public static ServiceLoader<Spout> spouts()
      Utility method to get the instance of the service provider responsible to get the handler of the Platform.Event
      Returns:
      the service provider to get the eventstubs handlers
    • spins

      public static ServiceLoader<Object> spins()
      Utility method to get the instance of the service provider responsible to get the handler of the overit.geocall.event.consumer.@EventConsumer
      Returns:
      the service provider to get the Spin
    • dataSets

      public static ServiceLoader<Object> dataSets()
      Utility method to get the instance of the service provider responsible to get the handler of the Platform.DataSet
      Returns:
      the service provider to get the dataset
    • jobs

      public static ServiceLoader<Object> jobs()
      Utility method to get the instance of the service provider responsible to get the handler of the overit.geocall.batch.scheduler.model.@JobComponent
      Returns:
      the service provider to get the overit.geocall.batch.scheduler.model.Job
    • pipes

      public static ServiceLoader<Object> pipes()
      Utility method to get the instance of the service provider responsible to get the handlers of the Platform.Pipe.
      Returns:
      the service provider to get the pipe request handlers.
    • tools

      public static ServiceLoader<Tool> tools()
      Utility method to get the instance of the service provider responsible to get the handler of the Customizable annotated types
      Returns:
      the service provider to get the auto discovered beans
    • dao

      public static ServiceLoader<Object> dao()
      Utility method to get the instance of the service provider responsible to get the handlers of the DAO.
      Returns:
      the service provider to get the DAO request handlers.
    • dataEntities

      public static ServiceLoader<Entity> dataEntities()
    • configurableComponents

      public static ServiceLoader<Object> configurableComponents()
      Utility method to get the instance of the Configurable components that are components objects tagged with the @Component.Configurable annotation
      Returns:
      the service provider to get the instance of the Configurable components
    • load

      public final Iterable<Provider<T>> load()
      Create a new service loader: an iterable instance that allow to iterate among the discovered services. The iterable returned by this method first yields all the elements of the provider cache, in the order that they were loaded. It then lazily loads and instantiates any remaining service providers, adding each one to the cache in turn. If this loader's provider caches are cleared by invoking the reload method then existing iterators for this service loader should be discarded.
      Returns:
      An iterable that lazily loads providers for this loader's service
    • load

      public final Iterable<Provider<T>> load(ClassLoader loader)
      Create a new service loader: an iterable instance that allow to iterate among the discovered services. The iterable returned by this method first yields all the elements of the provider cache, in the order that they were loaded. It then lazily loads and instantiates any remaining service providers, adding each one to the cache in turn. If this loader's provider caches are cleared by invoking the reload method then existing iterators for this service loader should be discarded.
      Parameters:
      loader - the class loader to be used to load provider-configuration files and provider classes, or null if the system class loader (or, failing that, the bootstrap class loader) is to be used
      Returns:
      An iterable that lazily loads providers for this loader's service
    • reload

      public final void reload()
      Clear this loader's provider cache so that all providers will be reloaded.

      After invoking this method, subsequent invocations of the load() methods will lazily locate providers from scratch, just as is done by a newly-created service loader.

    • reload

      public final void reload(ClassLoader loader)
      Clear this loader's provider cache so that all providers will be reloaded.

      After invoking this method, subsequent invocations of the load() methods will lazily locate providers from scratch, just as is done by a newly-created service loader.

      Parameters:
      loader - the class loader to be used to load provider-configuration files and provider classes, or null if the system class loader (or, failing that, the bootstrap class loader) is to be used