Class TemplateBuilderImpl
java.lang.Object
org.jclouds.compute.domain.internal.TemplateBuilderImpl
- All Implemented Interfaces:
- TemplateBuilder
- Direct Known Subclasses:
- ArbitraryCpuRamTemplateBuilderImpl,- EC2TemplateBuilderImpl
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected booleanprotected final com.google.common.base.Supplier<Location> protected final jakarta.inject.Provider<TemplateBuilder> protected booleanprotected Booleanprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected com.google.common.base.Predicate<Image> protected final ImageCacheSupplierprotected Stringprotected Locationprotected Loggerprotected doubleprotected doubleprotected intprotected TemplateOptionsprotected final jakarta.inject.Provider<TemplateOptions> protected Booleanprotected Stringprotected Stringprotected OsFamilyprotected Stringprotected String
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedTemplateBuilderImpl(com.google.common.base.Supplier<Set<? extends Location>> locations, com.google.common.base.Supplier<Set<? extends Image>> images, com.google.common.base.Supplier<Set<? extends Hardware>> hardwares, com.google.common.base.Supplier<Location> defaultLocation, jakarta.inject.Provider<TemplateOptions> optionsProvider, jakarta.inject.Provider<TemplateBuilder> defaultTemplateProvider) 
- 
Method SummaryModifier and TypeMethodDescriptionany()prime this builder with parameters known to work on the current compute provider.biggest()configure this template to the largest hardware, based on cores, ram, then diskbuild()Generate an immutable template from the current builder.fastest()configure this template to the fastest hardware, based on cpuprotected HardwarefindHardwareWithId(Set<? extends Hardware> hardwaresToSearch) Forces an image lookup against the provider to reload the image cache.Configure and return this template, updating it with the populated values of the givenspec.from(TemplateBuilderSpec spec) Configure and return this template, updating it with the populated values of the givenspec.fromHardware(Hardware hardware) Configure this template to require the minimum hardware of the parameter.Configure this template to fuzzy-match on the image parameterfromTemplate(Template template) Configure this template to match the resources of the template parameter.hardwareId(String hardwareId) Configure this template to require a specific hardwareId.protected com.google.common.collect.Ordering<Hardware> hypervisorMatches(String hypervisor) Configure this template to have an hypervisor that matches the regular expressionimageChooser(com.google.common.base.Function<Iterable<? extends Image>, Image> imageChooser) Configure this template with a specific preference function which operates on images which match the other criteria.imageDescriptionMatches(String descriptionRegex) Configure this template to have an image description that matches the regular expressionConfigure this template to require a specific imageId.imageMatches(com.google.common.base.Predicate<Image> condition) Configure this template to have an image that matches the supplied condition ex.imageNameMatches(String nameRegex) Configure this template to have an image name that matches the regular expressionimageVersionMatches(String imageVersionRegex) Configure this template to have an image version that matches the regular expressionlocationId(String locationId) Configure this template to start in a specific locationminCores(double minCores) Configure this template to require the minimum cores belowminDisk(double gigabytes) Configure this template with required minimum disk space in gigabytesminRam(int megabytes) Configure this template to require the minimum ram in megabytes belowoptions(TemplateOptions options) Sets options on the template (i.e.os64Bit(boolean is64Bit) Configure this template to require a 64 bit operating system.osArchMatches(String osArchitectureRegex) Configure this template to require a specific architecture.osDescriptionMatches(String osDescriptionRegex) Configure this template to have an operating system description that matches the regular expressionConfigure this template to use a specific operating system image.osNameMatches(String osNameRegex) Configure this template to have an operating system name that matches the regular expressionosVersionMatches(String osVersionRegex) Configure this template to have an os version that matches the regular expressionprotected HardwareresolveHardware(Set<? extends Hardware> hardwarel, Iterable<? extends Image> images) protected ImageresolveImage(Hardware hardware, Iterable<? extends Image> supportedImages) smallest()configure this template to the smallest hardware, based on cores, ram, then diskprotected com.google.common.base.MoreObjects.ToStringHelperstring()protected NoSuchElementExceptionthrowNoSuchElementExceptionAfterLoggingHardwareIds(String message, Iterable<? extends Hardware> hardwares) protected NoSuchElementExceptionthrowNoSuchElementExceptionAfterLoggingImageIds(String message, Iterable<? extends Image> images) toString()
- 
Field Details- 
logger
- 
images
- 
hardwares
- 
locations
- 
defaultLocation
- 
optionsProvider
- 
defaultTemplateProvider
- 
location
- 
imageId
- 
hardwareId
- 
hypervisor
- 
imageVersion
- 
osFamily
- 
osVersion
- 
os64Bit
- 
osName
- 
osDescription
- 
osArch
- 
imageName
- 
imageDescription
- 
imagePredicate
- 
imageChooser
- 
minCoresprotected double minCores
- 
minRamprotected int minRam
- 
minDiskprotected double minDisk
- 
biggestprotected boolean biggest
- 
fastestprotected boolean fastest
- 
options
- 
forceCacheReload
 
- 
- 
Constructor Details- 
TemplateBuilderImpl@Inject protected TemplateBuilderImpl(com.google.common.base.Supplier<Set<? extends Location>> locations, com.google.common.base.Supplier<Set<? extends Image>> images, com.google.common.base.Supplier<Set<? extends Hardware>> hardwares, com.google.common.base.Supplier<Location> defaultLocation, @Named("DEFAULT") jakarta.inject.Provider<TemplateOptions> optionsProvider, @Named("DEFAULT") jakarta.inject.Provider<TemplateBuilder> defaultTemplateProvider) 
 
- 
- 
Method Details- 
fromTemplateConfigure this template to match the resources of the template parameter.- Specified by:
- fromTemplatein interface- TemplateBuilder
 
- 
fromHardwareConfigure this template to require the minimum hardware of the parameter.- Specified by:
- fromHardwarein interface- TemplateBuilder
 
- 
fromImageConfigure this template to fuzzy-match on the image parameter- Specified by:
- fromImagein interface- TemplateBuilder
 
- 
smallestconfigure this template to the smallest hardware, based on cores, ram, then disk- Specified by:
- smallestin interface- TemplateBuilder
 
- 
biggestconfigure this template to the largest hardware, based on cores, ram, then disk- Specified by:
- biggestin interface- TemplateBuilder
 
- 
fastestconfigure this template to the fastest hardware, based on cpu- Specified by:
- fastestin interface- TemplateBuilder
 
- 
locationIdConfigure this template to start in a specific location- Specified by:
- locationIdin interface- TemplateBuilder
 
- 
osFamilyConfigure this template to use a specific operating system image.- Specified by:
- osFamilyin interface- TemplateBuilder
 
- 
buildGenerate an immutable template from the current builder.- Specified by:
- buildin interface- TemplateBuilder
 
- 
findHardwareWithId
- 
throwNoSuchElementExceptionAfterLoggingImageIdsprotected NoSuchElementException throwNoSuchElementExceptionAfterLoggingImageIds(String message, Iterable<? extends Image> images) 
- 
throwNoSuchElementExceptionAfterLoggingHardwareIdsprotected NoSuchElementException throwNoSuchElementExceptionAfterLoggingHardwareIds(String message, Iterable<? extends Hardware> hardwares) 
- 
resolveHardware
- 
imageChooser
- 
hardwareSorter
- 
resolveImage- Parameters:
- hardware-
- supportedImages-
- Throws:
- NoSuchElementException- if there's no image that matches the predicate
 
- 
getImages
- 
imageIdConfigure this template to require a specific imageId. Note that image Ids are often scoped tolocation- Specified by:
- imageIdin interface- TemplateBuilder
 
- 
imageNameMatchesConfigure this template to have an image name that matches the regular expression- Specified by:
- imageNameMatchesin interface- TemplateBuilder
 
- 
imageDescriptionMatchesConfigure this template to have an image description that matches the regular expression- Specified by:
- imageDescriptionMatchesin interface- TemplateBuilder
 
- 
imageMatchesConfigure this template to have an image that matches the supplied condition ex.builder.imageMatches(ImagePredicates.userMetadataContains("author", "sue"));- Specified by:
- imageMatchesin interface- TemplateBuilder
 
- 
imageChooserpublic TemplateBuilderImpl imageChooser(com.google.common.base.Function<Iterable<? extends Image>, Image> imageChooser) Configure this template with a specific preference function which operates on images which match the other criteria.If no function is supplied, jclouds will select one according to an internal strategy. This strategy may change from version to version. - Specified by:
- imageChooserin interface- TemplateBuilder
 
- 
imageVersionMatchesConfigure this template to have an image version that matches the regular expression- Specified by:
- imageVersionMatchesin interface- TemplateBuilder
 
- 
osVersionMatchesConfigure this template to have an os version that matches the regular expression- Specified by:
- osVersionMatchesin interface- TemplateBuilder
 
- 
osArchMatchesConfigure this template to require a specific architecture. ex. virtualizationType or- Specified by:
- osArchMatchesin interface- TemplateBuilder
 
- 
minCoresConfigure this template to require the minimum cores below- Specified by:
- minCoresin interface- TemplateBuilder
 
- 
minRamConfigure this template to require the minimum ram in megabytes below- Specified by:
- minRamin interface- TemplateBuilder
 
- 
minDiskConfigure this template with required minimum disk space in gigabytes- Specified by:
- minDiskin interface- TemplateBuilder
 
- 
osNameMatchesConfigure this template to have an operating system name that matches the regular expression- Specified by:
- osNameMatchesin interface- TemplateBuilder
 
- 
osDescriptionMatchesConfigure this template to have an operating system description that matches the regular expression- Specified by:
- osDescriptionMatchesin interface- TemplateBuilder
 
- 
hardwareIdConfigure this template to require a specific hardwareId.- Specified by:
- hardwareIdin interface- TemplateBuilder
 
- 
hypervisorMatchesConfigure this template to have an hypervisor that matches the regular expression- Specified by:
- hypervisorMatchesin interface- TemplateBuilder
 
- 
optionsSets options on the template (i.e. items which adorn a created node rather than restricting selection of the node). Note that this method typically replaces any options previously specified in the builder. Normal usage is to build up all options and pass them to the builder with a single call to this method.- Specified by:
- optionsin interface- TemplateBuilder
 
- 
anyprime this builder with parameters known to work on the current compute provider.- Specified by:
- anyin interface- TemplateBuilder
 
- 
toString
- 
stringprotected com.google.common.base.MoreObjects.ToStringHelper string()- Since:
- 1.5
 
- 
os64BitDescription copied from interface:TemplateBuilderConfigure this template to require a 64 bit operating system.- Specified by:
- os64Bitin interface- TemplateBuilder
 
- 
fromDescription copied from interface:TemplateBuilderConfigure and return this template, updating it with the populated values of the givenspec.- Specified by:
- fromin interface- TemplateBuilder
 
- 
fromDescription copied from interface:TemplateBuilderConfigure and return this template, updating it with the populated values of the givenspec. This is especially useful for command-line configuration of aTemplateBuilder.- Specified by:
- fromin interface- TemplateBuilder
- Parameters:
- spec- a String in the format specified by- TemplateBuilderSpec
 
- 
forceCacheReloadDescription copied from interface:TemplateBuilderForces an image lookup against the provider to reload the image cache.Use with caution. In some providers getting the list of images is an expensive operation, and the use of the image cache is recommended. If there is a need to minimize the amount of time the images are cached, consider configuring the cache expiration time by setting the Constants.PROPERTY_SESSION_INTERVALproperty.- Specified by:
- forceCacheReloadin interface- TemplateBuilder
 
 
-