brooklyn.entity.drivers.downloads
Interface DownloadResolverManager


public interface DownloadResolverManager

Used by an EntityDriver to obtain the download locations when installing an entity. Most commonly, the DownloadResolver's targets are URIs. However, an EntityDriver implementation is free to interpret the String however is appropriate (e.g. the name of a custom package to install from the enterprise's package manager repository). Also supports registering other "resolvers" for determining where to download the installers from, for different entities. When using resolve(EntityDriver) to get the list of things to try (in-order until one succeeds), the manager will go through each of the registered resolvers in-order to get their contributions. These contributions are split into "primary" and "fallback". All of the primaries will be added to the list first, and then all of the fallbacks.


Nested Class Summary
static interface DownloadResolverManager.DownloadRequirement
          Gives artifact meta-data for what is required to be downloaded.
static interface DownloadResolverManager.DownloadTargets
          Describes the download locations, and their order, to try.
 
Method Summary
 DownloadResolver newDownloader(EntityDriver driver)
          For installing the main entity.
 DownloadResolver newDownloader(EntityDriver driver, Map<String,?> properties)
          For installing the main entity.
 DownloadResolver newDownloader(EntityDriver driver, String addonName, Map<String,?> addonProperties)
          For installing an entity add-on.
 void registerFilenameProducer(com.google.common.base.Function<? super DownloadResolverManager.DownloadRequirement,String> producer)
          Registers a producer for generating the expected filename of the download artifact.
 void registerPrimaryProducer(com.google.common.base.Function<? super DownloadResolverManager.DownloadRequirement,? extends DownloadResolverManager.DownloadTargets> resolver)
          Registers a producer, to be tried before all other producers.
 void registerProducer(com.google.common.base.Function<? super DownloadResolverManager.DownloadRequirement,? extends DownloadResolverManager.DownloadTargets> resolver)
          Registers a producer, to be tried after all other registered producers have been tried.
 

Method Detail

newDownloader

DownloadResolver newDownloader(EntityDriver driver)
For installing the main entity. Returns a list of options, to be tried in order until one of them works.


newDownloader

DownloadResolver newDownloader(EntityDriver driver,
                               Map<String,?> properties)
For installing the main entity. Returns a list of options, to be tried in order until one of them works.


newDownloader

DownloadResolver newDownloader(EntityDriver driver,
                               String addonName,
                               Map<String,?> addonProperties)
For installing an entity add-on. Returns a list of options, to be tried in order until one of them works. This is used for resolving the download for an "add-on" - e.g. an additional module required during an entity's installation. Common properties include:


registerPrimaryProducer

void registerPrimaryProducer(com.google.common.base.Function<? super DownloadResolverManager.DownloadRequirement,? extends DownloadResolverManager.DownloadTargets> resolver)
Registers a producer, to be tried before all other producers. A "producer" will generate the download targets to be tried, when installing a given entity or entity add-on. The function should not return null (instead see BasicDownloadTargets.empty()).

See Also:
registerResolver(Function)

registerProducer

void registerProducer(com.google.common.base.Function<? super DownloadResolverManager.DownloadRequirement,? extends DownloadResolverManager.DownloadTargets> resolver)
Registers a producer, to be tried after all other registered producers have been tried. The function should not return null (instead see BasicDownloadTargets.empty()).


registerFilenameProducer

void registerFilenameProducer(com.google.common.base.Function<? super DownloadResolverManager.DownloadRequirement,String> producer)
Registers a producer for generating the expected filename of the download artifact. If all such registered producers return null, then default behaviour is to infer the download name from the first target in the resolve(EntityDriver) result.



Copyright © 2013. All Rights Reserved.