Class Amber

java.lang.Object
enterprises.iwakura.amber.Amber

public class Amber extends Object
The entrypoint for Amber's bootstrapping functionality.

You may create an instance of this class using one of the static factory methods or its constructor.

  • Field Details

    • manifestLoader

      protected final ManifestLoader manifestLoader
      The manifest loader to load Amber manifests.
    • downloaders

      protected final Map<RepositoryType,DependencyDownloader> downloaders
      The map of repository types to their corresponding dependency downloaders.
    • checksumValidator

      protected final ChecksumValidator checksumValidator
      The checksum validator to validate downloaded dependencies.
    • logger

      protected final Logger logger
      The logger to log messages during the bootstrapping process.
  • Constructor Details

    • Amber

      public Amber()
  • Method Details

    • classLoader

      public static Amber classLoader()
      Create an Amber instance that loads manifests from the current thread's context class loader. Uses ConsoleLogger with debug messages disabled.
      Returns:
      An Amber instance.
    • classLoader

      public static Amber classLoader(ClassLoader classLoader)
      Create an Amber instance that loads manifests from the specified class loader. Uses ConsoleLogger with debug messages disabled.
      Parameters:
      classLoader - The class loader to load manifests from.
      Returns:
      An Amber instance.
    • classLoader

      public static Amber classLoader(ClassLoader classLoader, Logger logger)
      Create an Amber instance that loads manifests from the specified class loader and uses the specified logger.
      Parameters:
      classLoader - The class loader to load manifests from.
      logger - The logger to use for logging messages.
      Returns:
      An Amber instance.
    • jarFiles

      public static Amber jarFiles(List<Path> jarFilePaths)
      Create an Amber instance that loads manifests from the specified list of jar file paths. Uses ConsoleLogger with debug messages disabled.
      Parameters:
      jarFilePaths - The list of jar file paths to load manifests from.
      Returns:
      An Amber instance.
    • jarFiles

      public static Amber jarFiles(List<Path> jarFilePaths, Logger logger)
      Create an Amber instance that loads manifests from the specified list of jar file paths and uses the specified logger.
      Parameters:
      jarFilePaths - The list of jar file paths to load manifests from.
      logger - The logger to use for logging messages.
      Returns:
      An Amber instance.
    • bootstrap

      public List<Path> bootstrap() throws IOException
      Bootstraps dependencies as per the loaded Amber manifests with default options.
      Returns:
      A list of jar files that were required by loaded manifests. This includes dependencies that were already present in the library directories.
      Throws:
      IOException - If an I/O error occurs during bootstrapping.
    • bootstrap

      public List<Path> bootstrap(BootstrapOptions options) throws IOException
      Bootstraps dependencies as per the loaded Amber manifests with the specified options.
      Parameters:
      options - The bootstrap options to use.
      Returns:
      A list of jar files that were required by loaded manifests. This includes dependencies that were already present in the library directories.
      Throws:
      IOException - If an I/O error occurs during bootstrapping.
    • processManifest

      protected List<Path> processManifest(AmberManifest manifest, BootstrapOptions options) throws IOException
      Processes a single Amber manifest to download its dependencies as per the specified options.
      Parameters:
      manifest - the Amber manifest to process
      options - the bootstrap options to use
      Returns:
      a list of paths to the downloaded (or already existing) dependencies
      Throws:
      IOException - if an I/O error occurs during processing
    • isDependencyDownloaded

      protected boolean isDependencyDownloaded(Dependency dependency, AmberManifest manifest, BootstrapOptions options)
      Checks if the specified dependency is already downloaded in the preferred library directory as per the manifest and options.
      Parameters:
      dependency - the dependency to check
      manifest - the Amber manifest containing the dependency
      options - the bootstrap options to consider
      Returns:
      true if the dependency is already downloaded, false otherwise