public class FixedListMachineProvisioningLocation<T extends MachineLocation> extends AbstractLocation implements MachineProvisioningLocation<T>, java.io.Closeable
MachineLocations which takes a list of machines it can connect to.
 The collection of initial machines should be supplied in the 'machines' flag in the constructor,
 for example a list of machines which can be SSH'd to. 
 
 This can be extended to have a mechanism to make more machines to be available
 (override provisionMore and canProvisionMore).| Modifier and Type | Class and Description | 
|---|---|
| static class  | FixedListMachineProvisioningLocation.BuilderFacilitates fluent/programmatic style for constructing a fixed pool of machines. | 
AbstractLocation.BasicSubscriptionSupportBrooklynObject.RelationSupport<T extends BrooklynObject>, BrooklynObject.SubscriptionSupport, BrooklynObject.TagSupportConfigurable.ConfigurationSupportBrooklynObjectInternal.ConfigurationSupportInternal, BrooklynObjectInternal.RelationSupportInternal<T extends BrooklynObject>, BrooklynObjectInternal.SubscriptionSupportInternal| Modifier and Type | Field and Description | 
|---|---|
| static ConfigKey< | MACHINE_CHOOSER | 
| static ConfigKey<java.util.Collection<MachineLocationCustomizer>> | MACHINE_LOCATION_CUSTOMIZERS | 
| static ConfigKey<java.util.List<LocationSpec<? extends MachineLocation>>> | MACHINE_SPECSThe machineSpecs allows  ByonLocationResolverto work with just LocationSpecs, rather than 
 having to instantiate the machines immediately (which would be bad, because the caller
 might not use the spec and thus might not unmanage the machine instances). | 
LOG, PARENT_LOCATION, TEMPORARY_LOCATIONFINAL_SPEC, NAMED_SPEC_NAME, ORIGINAL_SPEC| Constructor and Description | 
|---|
| FixedListMachineProvisioningLocation() | 
| FixedListMachineProvisioningLocation(java.util.Map properties) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addChild(Location child) | 
| void | addMachine(T machine) | 
| void | close() | 
| AbstractLocation | configure(java.util.Map<?,?> properties)Will set fields from flags, and put the remaining ones into the 'leftovers' map. | 
| java.util.Set<T> | getAllMachines() | 
| java.util.Set<T> | getAvailable() | 
| java.util.Set<T> | getInUse() | 
| java.util.Map<java.lang.String,java.lang.Object> | getProvisioningFlags(java.util.Collection<java.lang.String> tags)Gets flags, suitable as an argument to  MachineProvisioningLocation.obtain(Map). | 
| void | init()Called by framework (in new-style instances where spec was used) after configuring etc,
 but before a reference to this instance is shared. | 
| FixedListMachineProvisioningLocation<T> | newSubLocation(java.util.Map<?,?> newFlags)Creates a new location of the same type, but with additional creation instructions in the form of flags,
 e.g. | 
| T | obtain() | 
| T | obtain(java.util.Map<?,?> flags)Obtain a machine in this location. | 
| void | release(T machine)Release a previously-obtained machine. | 
| boolean | removeChild(Location child) | 
| void | removeMachine(T machine) | 
| java.lang.String | toVerboseString() | 
addExtension, config, containsLocation, equals, getAllConfig, getAllConfigBag, getChildren, getConfig, getConfig, getDisplayName, getExtension, getHostGeoInfo, getLocalConfigBag, getParent, getRawLocalConfigBag, getRebindSupport, hasConfig, hasExtension, hashCode, isManaged, onManagementStarted, onManagementStopped, relations, setConfig, setDisplayName, setHostGeoInfo, setManagementContext, setName, setParent, setParent, subscriptions, toMetadataRecord, toStringgetCatalogItemId, getId, getManagementContext, rebind, setCatalogItemId, tagscontainsLocation, getAllConfig, getChildren, getConfig, getDisplayName, getExtension, getId, getParent, hasConfig, hasExtension, relations, setParentgetCatalogItemId, subscriptions, tagsconfig, getConfig, setConfiggetManagementContextsetCatalogItemIdpublic static final ConfigKey<> MACHINE_CHOOSER 
public static final ConfigKey<java.util.Collection<MachineLocationCustomizer>> MACHINE_LOCATION_CUSTOMIZERS
public static final ConfigKey<java.util.List<LocationSpec<? extends MachineLocation>>> MACHINE_SPECS
ByonLocationResolver to work with just LocationSpecs, rather than 
 having to instantiate the machines immediately (which would be bad, because the caller
 might not use the spec and thus might not unmanage the machine instances).
 
 We clear the machineSpecs in init, so they will never be persisted. This will help with
 backwards compatibility if we change how this is done.
 
 By the end of init(), the machines will contain the full list of locations; 
 it will never contain a LocationSpec.public FixedListMachineProvisioningLocation()
public FixedListMachineProvisioningLocation(java.util.Map properties)
public void init()
AbstractBrooklynObjectTo preserve backwards compatibility for if the instance is constructed directly, one can call the code below, but that means it will be called after references to this policy have been shared with other entities.
 if (isLegacyConstruction()) {
     init();
 }
 
 init in class AbstractBrooklynObjectpublic java.lang.String toVerboseString()
toVerboseString in interface LocationtoVerboseString in class AbstractLocationpublic AbstractLocation configure(java.util.Map<?,?> properties)
AbstractBrooklynObjectConfigBag.getUnusedConfig().
 To be overridden by AbstractEntity, AbstractLoation, AbstractPolicy, AbstractEnricher, etc.
But should not be overridden by specific entity types. If you do, the entity may break in subsequent releases. Also note that if you require fields to be initialized you must do that in this method. You must *not* rely on field initializers because they may not run until *after* this method (this method is invoked by the constructor in this class, so initializers in subclasses will not have run when this overridden method is invoked.)
configure in class AbstractLocationpublic FixedListMachineProvisioningLocation<T> newSubLocation(java.util.Map<?,?> newFlags)
MachineProvisioningLocationImplementers who wish to subclass this provisioning location for additional functionality in a specific cloud can use the relevant implementation of this method as a guide.
newSubLocation in interface MachineProvisioningLocation<T extends MachineLocation>public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic void addMachine(T machine)
public void removeMachine(T machine)
public java.util.Set<T> getAvailable()
public java.util.Set<T> getInUse()
public java.util.Set<T> getAllMachines()
public void addChild(Location child)
addChild in class AbstractLocationpublic boolean removeChild(Location child)
removeChild in class AbstractLocationpublic T obtain() throws NoMachinesAvailableException
NoMachinesAvailableExceptionpublic T obtain(java.util.Map<?,?> flags) throws NoMachinesAvailableException
MachineProvisioningLocationobtain in interface MachineProvisioningLocation<T extends MachineLocation>obtain in interface ProvisioningLocation<T extends MachineLocation>flags - Details of the desired machine (e.g. image, size, open ports, etc; some flag support is limited to selected providers).
 "callerContext" can be specified to have custom logging and error messages (useful if starting machines in parallel)NoMachinesAvailableException - if there are no machines available in this location (or impls may return null, but that is discouraged)public void release(T machine)
MachineProvisioningLocationrelease in interface MachineProvisioningLocation<T extends MachineLocation>release in interface ProvisioningLocation<T extends MachineLocation>machine - a MachineLocation previously obtained from a call to #obtain()public java.util.Map<java.lang.String,java.lang.Object> getProvisioningFlags(java.util.Collection<java.lang.String> tags)
MachineProvisioningLocationMachineProvisioningLocation.obtain(Map). The tags provided give
 hints about the machine required. The provisioning-location could be configured to 
 understand those tags. 
 
 For example, an AWS-location could be configured to understand that a particular entity
 type (e.g. "TomcatServer") requires a particular AMI in that region, so would return the 
 required image id.getProvisioningFlags in interface MachineProvisioningLocation<T extends MachineLocation>