Class DefaultModuleDependencyLoader

java.lang.Object
eu.cloudnetservice.driver.impl.module.DefaultModuleDependencyLoader
All Implemented Interfaces:
eu.cloudnetservice.driver.module.ModuleDependencyLoader

public class DefaultModuleDependencyLoader extends Object implements eu.cloudnetservice.driver.module.ModuleDependencyLoader
Represents the default implementation of the module dependency loader.
Since:
4.0
  • Field Details

    • FILE_NAME_FORMAT

      protected static final String FILE_NAME_FORMAT
      A format for the file name with which the module will be stored: name-version.jar
      See Also:
    • REMOTE_DEPENDENCY_URL_FORMAT

      protected static final String REMOTE_DEPENDENCY_URL_FORMAT
      Represents a maven dependency download url in the format: repo-urlgroup/name/version/name-version.jar.
      See Also:
    • baseDirectory

      protected final Path baseDirectory
  • Constructor Details

    • DefaultModuleDependencyLoader

      public DefaultModuleDependencyLoader(@NonNull @NonNull Path baseDirectory)
      Constructs a new instance of this class.
      Parameters:
      baseDirectory - the base directory in which the dependencies should be stored.
      Throws:
      NullPointerException - if the given base directory is null.
  • Method Details

    • loadModuleDependencyByUrl

      @NonNull public @NonNull URL loadModuleDependencyByUrl(@NonNull @NonNull eu.cloudnetservice.driver.module.ModuleConfiguration configuration, @NonNull @NonNull eu.cloudnetservice.driver.module.ModuleDependency dependency) throws Exception
      Specified by:
      loadModuleDependencyByUrl in interface eu.cloudnetservice.driver.module.ModuleDependencyLoader
      Throws:
      Exception
    • loadModuleDependencyByRepository

      @NonNull public @NonNull URL loadModuleDependencyByRepository(@NonNull @NonNull eu.cloudnetservice.driver.module.ModuleConfiguration configuration, @NonNull @NonNull eu.cloudnetservice.driver.module.ModuleDependency dependency, @NonNull @NonNull String repositoryUrl) throws Exception
      Specified by:
      loadModuleDependencyByRepository in interface eu.cloudnetservice.driver.module.ModuleDependencyLoader
      Throws:
      Exception
    • loadDependency

      @NonNull protected @NonNull URL loadDependency(@NonNull @NonNull eu.cloudnetservice.driver.module.ModuleDependency dependency, @NonNull @NonNull URL url) throws Exception
      Loads and stores a dependency on the local file system. This method will not override existing versions of the file.
      Parameters:
      dependency - the dependency which gets loaded.
      url - the url from where the dependency should be loaded.
      Returns:
      the url to the file on the local file system after the load.
      Throws:
      Exception - if any exception occurs during the load of the dependency.
      NullPointerException - if either the given dependency or url is null.
    • baseDirectory

      @NonNull public @NonNull Path baseDirectory()
      Get the base directory in which the dependencies should be stored.
      Returns:
      the base directory in which the dependencies should be stored.
      See Also: