Brooklyn

brooklyn.entity.drivers.downloads
[Java] Class DownloadProducerFromProperties

java.lang.Object
  brooklyn.entity.drivers.downloads.DownloadProducerFromProperties
All Implemented Interfaces:
Function

public class DownloadProducerFromProperties

Based on the contents of brooklyn properties, sets up rules for resolving where to download artifacts from, for installing entities. By default, these rules override the DOWNLOAD_URL defined on the entities in code. Global properties can be specified that apply to all entities. Entity-specific properties can also be specified (which override the global properties for that entity type). Below is an example of realistic configuration for an enterprise who have an in-house repository that must be used for everything, rather than going out to the public internet.

 // FIXME Check format for including addonname- only if addonname is non-null?
 // FIXME Use this in a testng test case
 brooklyn.downloads.all.url=http://downloads.acme.com/brookyn/repository/${simpletype/${simpletype}-${addon?? addon-}${version}.${fileSuffix!.tar.gz}
 }
 
To illustrate the features and variations one can use, below is an example of global properties that can be specified. The semicolon-separated list of URLs will be tried in-order until one succeeds. The fallback url says to use that if all other URLs fail (or no others are specified).
 brooklyn.downloads.all.url=http://myurl1/${simpletype-${version}.tar.gz; http://myurl2/${simpletype}-${version}.tar.gz
 brooklyn.downloads.all.fallbackurl=http://myurl3/${simpletype}-${version}.tar.gz
 }
 
Similarly, entity-specific properties can be defined. All "global properties" will also apply to this entity type, unless explicitly overridden.
 brooklyn.downloads.entity.tomcatserver.url=http://mytomcaturl1/tomcat-${version.tar.gz
 brooklyn.downloads.entity.tomcatserver.fallbackurl=http://myurl2/tomcat-${version}.tar.gz
 }
 
Downloads for entity-specific add-ons can also be defined. All "global properties" will also apply to this entity type, unless explicitly overridden.
 brooklyn.downloads.entity.nginxcontroller.addon.stickymodule.url=http://myurl1/nginx-stickymodule-${version.tar.gz
 brooklyn.downloads.entity.nginxcontroller.addon.stickymodule.fallbackurl=http://myurl2/nginx-stickymodule-${version}.tar.gz
 }
 
If no explicit URLs are supplied, then by default it will use the DOWNLOAD_URL attribute of the entity (if supplied), followed by the fallbackurl if that fails. A URL can be a "template", where things of the form ${version} will be substituted for the value of "version" provided for that entity. The freemarker template engine is used to convert URLs (see http). For example, one could use the URL:
 http://repo.acme.com/${simpletype-${version}.${fileSuffix!tar.gz}
 }
 
The following substitutions are available automatically for a template:


Field Summary
static java.lang.String DOWNLOAD_CONF_PREFIX

 
Constructor Summary
DownloadProducerFromProperties(StringConfigMap config)

 
Method Summary
DownloadTargets apply(DownloadRequirement downloadRequirement)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

DOWNLOAD_CONF_PREFIX

public static final java.lang.String DOWNLOAD_CONF_PREFIX


 
Constructor Detail

DownloadProducerFromProperties

public DownloadProducerFromProperties(StringConfigMap config)


 
Method Detail

apply

public DownloadTargets apply(DownloadRequirement downloadRequirement)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.