Package enterprises.iwakura.amber
Class Amber
java.lang.Object
enterprises.iwakura.amber.Amber
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final ChecksumValidatorThe checksum validator to validate downloaded dependencies.protected booleanIndicates whether any dependencies were downloaded during the bootstrapping process.protected final Map<RepositoryType, DependencyDownloader> The map of repository types to their corresponding dependency downloaders.protected final LoggerThe logger to log messages during the bootstrapping process.protected final ManifestLoaderThe manifest loader to load Amber manifests. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBootstraps dependencies as per the loaded Amber manifests with default options.bootstrap(BootstrapOptions options) Bootstraps dependencies as per the loaded Amber manifests with the specified options.static AmberCreate an Amber instance that loads manifests from the current thread's context class loader.static AmberclassLoader(ClassLoader classLoader) Create an Amber instance that loads manifests from the specified class loader.static AmberclassLoader(ClassLoader classLoader, Logger logger) Create an Amber instance that loads manifests from the specified class loader and uses the specified logger.protected booleanisDependencyDownloaded(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.static AmberCreate an Amber instance that loads manifests from the specified list of jar file paths.static AmberCreate an Amber instance that loads manifests from the specified list of jar file paths and uses the specified logger.processManifest(AmberManifest manifest, BootstrapOptions options) Processes a single Amber manifest to download its dependencies as per the specified options.
-
Field Details
-
manifestLoader
The manifest loader to load Amber manifests. -
downloaders
The map of repository types to their corresponding dependency downloaders. -
checksumValidator
The checksum validator to validate downloaded dependencies. -
logger
The logger to log messages during the bootstrapping process. -
downloadedSomething
protected boolean downloadedSomethingIndicates whether any dependencies were downloaded during the bootstrapping process.
-
-
Constructor Details
-
Amber
public Amber()
-
-
Method Details
-
classLoader
Create an Amber instance that loads manifests from the current thread's context class loader. UsesConsoleLoggerwith debug messages disabled.- Returns:
- An Amber instance.
-
classLoader
Create an Amber instance that loads manifests from the specified class loader. UsesConsoleLoggerwith debug messages disabled.- Parameters:
classLoader- The class loader to load manifests from.- Returns:
- An Amber instance.
-
classLoader
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
Create an Amber instance that loads manifests from the specified list of jar file paths. UsesConsoleLoggerwith debug messages disabled.- Parameters:
jarFilePaths- The list of jar file paths to load manifests from.- Returns:
- An Amber instance.
-
jarFiles
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
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
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 processoptions- 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 checkmanifest- the Amber manifest containing the dependencyoptions- the bootstrap options to consider- Returns:
- true if the dependency is already downloaded, false otherwise
-