Class MapRepositoryProvider

java.lang.Object
org.eclipse.emf.cdo.spi.server.MapRepositoryProvider
All Implemented Interfaces:
IRepositoryProvider

public final class MapRepositoryProvider extends Object implements IRepositoryProvider
Provides an immutable, explicitly selected set of repositories by configured names or aliases. The copied mapping prevents later caller changes from altering repository exposure, and its enumeration is a stable snapshot for the lifetime of this provider.
Since:
4.27
Author:
Eike Stepper
  • Constructor Details

    • MapRepositoryProvider

      public MapRepositoryProvider(Map<String, ? extends IRepository> repositories)
      Creates a provider from an explicit mapping of lookup names to repositories. Lookup names are independent of the values returned by CDOCommonRepository.getName(), allowing deployments to expose repositories under aliases.
      Parameters:
      repositories - the names to expose and their repository instances
      Throws:
      NullPointerException - if the map, a name, or a repository is null
  • Method Details

    • getRepository

      public IRepository getRepository(String name)
      Description copied from interface: IRepositoryProvider
      Resolves a repository by a name understood by this provider.
      Specified by:
      getRepository in interface IRepositoryProvider
      Parameters:
      name - the repository lookup name or alias
      Returns:
      the repository associated with the name, or null if the provider has no such repository
    • getRepositoryNames

      public Set<String> getRepositoryNames()
      Description copied from interface: IRepositoryProvider
      Returns a snapshot of the names that this provider can currently use to resolve repositories. The names are provider lookup names and may be aliases; they are not required to equal CDOCommonRepository.getName(). A name in the returned snapshot resolves through IRepositoryProvider.getRepository(String) when it is returned, but a dynamic provider may be changed immediately afterwards. The returned set must not change after this method returns.
      Specified by:
      getRepositoryNames in interface IRepositoryProvider
      Returns:
      an immutable snapshot, which may be empty when enumeration is supported but no repositories are available