Class LocationManager


  • @Named
    @Singleton
    public class LocationManager
    extends java.lang.Object
    Maps artifacts to modules and analyzes the type of required modules
    Since:
    1.0.0
    • Constructor Detail

      • LocationManager

        public LocationManager()
    • Method Detail

      • parseModuleDescriptor

        public ResolvePathResult parseModuleDescriptor​(java.nio.file.Path descriptorPath)
                                                throws java.io.IOException
        Parameters:
        descriptorPath - never null
        Returns:
        the parsed module descriptor
        Throws:
        java.io.IOException - when descriptorPath could not be read
      • parseModuleDescriptor

        public ResolvePathResult parseModuleDescriptor​(java.io.File descriptorPath)
                                                throws java.io.IOException
        Parameters:
        descriptorPath - never null
        Returns:
        the parsed module descriptor
        Throws:
        java.io.IOException - when descriptorPath could not be read
      • parseModuleDescriptor

        public ResolvePathResult parseModuleDescriptor​(java.lang.String descriptorPath)
                                                throws java.io.IOException
        Parameters:
        descriptorPath - never null
        Returns:
        the parsed module descriptor
        Throws:
        java.io.IOException - when descriptorPath could not be read
      • resolvePath

        public <T> ResolvePathResult resolvePath​(ResolvePathRequest<T> request)
                                          throws java.io.IOException
        Resolve a single jar
        Parameters:
        request - the request
        Returns:
        the ResolvePathResult, containing the name and optional module descriptor
        Throws:
        java.io.IOException - if any occurs
      • resolvePaths

        public <T> ResolvePathsResult<T> resolvePaths​(ResolvePathsRequest<T> request)
                                               throws java.io.IOException
        Decide for every request.getPathElements() if it belongs to the modulePath or classPath, based on the request.getMainModuleDescriptor().
        Parameters:
        request - the paths to resolve
        Returns:
        the result of the resolution
        Throws:
        java.io.IOException - if a critical IOException occurs
      • getBinaryModuleInfoParser

        ModuleInfoParser getBinaryModuleInfoParser​(java.nio.file.Path jdkHome)
        If the jdkHome is specified, its version it considered higher than the runtime java version. In that case ASM must be used to read the module descriptor
        Parameters:
        jdkHome -
        Returns:
      • selectRequires

        private void selectRequires​(JavaModuleDescriptor module,
                                    java.util.Map<java.lang.String,​JavaModuleDescriptor> availableModules,
                                    java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> availableProviders,
                                    java.util.Set<java.lang.String> namedModules,
                                    boolean isRootModule,
                                    boolean includeAsTransitive,
                                    boolean includeStatic)
      • selectModule

        private void selectModule​(java.lang.String module,
                                  java.util.Map<java.lang.String,​JavaModuleDescriptor> availableModules,
                                  java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> availableProviders,
                                  java.util.Set<java.lang.String> namedModules,
                                  boolean isRootModule,
                                  boolean includeTransitive,
                                  boolean includeStatic)
      • collectProviders

        private void collectProviders​(JavaModuleDescriptor moduleDescriptor,
                                      java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> availableProviders)