Class ServiceFinder


  • public class ServiceFinder
    extends Object
    A finder for service provider interface (SPI) registries.
    Since:
    SNAP 2.0
    • Constructor Detail

      • ServiceFinder

        public ServiceFinder​(Class serviceType)
        Constructor.
        Parameters:
        serviceType - The service type or service provider interface (SPI).
      • ServiceFinder

        public ServiceFinder​(String serviceName)
        Constructor.
        Parameters:
        serviceName - The service's name.
    • Method Detail

      • getServicesPath

        public String getServicesPath()
        Returns:
        The service's path.
      • getUseClassPath

        public boolean getUseClassPath()
        Returns:
        true if this ServiceFinder uses the JVM's class path´to find modules.
      • setUseClassPath

        public void setUseClassPath​(boolean value)
        Parameters:
        value - If true, the JVM's class path shall be searched as well
      • getUseZipFiles

        public boolean getUseZipFiles()
        Returns:
        true if this ServiceFinder uses the JVM's class path to find modules.
      • setUseZipFiles

        public void setUseZipFiles​(boolean value)
        Parameters:
        value - If true, any ZIP and JAR files are searched as well
      • getSearchPaths

        public List<Path> getSearchPaths()
        Returns:
        The list of search paths.
      • addSearchPath

        public void addSearchPath​(Path path)
        Adds a search (directory) path.
        Parameters:
        path - A search path.
      • addSearchPaths

        public void addSearchPaths​(Path... paths)
        Adds search (directory) paths.
        Parameters:
        paths - The search paths.
      • addSearchPathsFromPreferences

        public void addSearchPathsFromPreferences​(String configName,
                                                  String key)
        Adds search paths from user preferences. The value is be a colon- (Unix) or semicolon-separated list of (directory) paths.
        Parameters:
        configName - The configuration name.
        key - The user preferences key.
      • addSearchPathsFromPreferences

        public void addSearchPathsFromPreferences​(String key)
        Adds search paths from user preferences. The value is be a colon- (Unix) or semicolon-separated list of (directory) paths.
        Parameters:
        key - The user preferences key.
      • findServices

        public List<ServiceFinder.Module> findServices()
        Finds services based on the current search path configuration.
        Returns:
        List of modules providing the services.