Brooklyn

brooklyn.location.basic
[Java] Class FixedListMachineProvisioningLocation

java.lang.Object
  brooklyn.location.basic.AbstractLocation
      brooklyn.location.basic.FixedListMachineProvisioningLocation
All Implemented Interfaces:
java.io.Closeable, MachineProvisioningLocation

public class FixedListMachineProvisioningLocation
extends AbstractLocation

A provisioner of 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).


Nested Class Summary
static class FixedListMachineProvisioningLocation.Builder

Facilitates fluent/programmatic style for constructing a fixed pool of machines.

 
Field Summary
protected java.util.Set inUse

protected java.util.Set machines

protected java.util.Set pendingRemoval

 
Fields inherited from class AbstractLocation
LOG, PARENT_LOCATION, hostGeoInfo, name
 
Constructor Summary
FixedListMachineProvisioningLocation()

FixedListMachineProvisioningLocation(java.util.Map properties)

 
Method Summary
void addChild(Location child)

void addMachine(java.lang.Object machine)

protected boolean canProvisionMore()

void close()

void configure(java.util.Map properties)

java.util.Set getAllMachines()

java.util.Set getAvailable()

java.util.Set getInUse()

protected java.util.Set getMachines()

java.util.Map getProvisioningFlags(java.util.Collection tags)

void init()

FixedListMachineProvisioningLocation newSubLocation(java.util.Map newFlags)

java.lang.Object obtain()

java.lang.Object obtain(java.util.Map flags)

protected void provisionMore(int size)

protected void provisionMore(int size, java.util.Map flags)

void release(java.lang.Object machine)

protected boolean removeChild(Location child)

void removeMachine(java.lang.Object machine)

java.lang.String toVerboseString()

 
Methods inherited from class AbstractLocation
addChild, addChild, addChildLocation, addExtension, assertNotYetManaged, configure, containsLocation, equals, findLocationProperty, getAllConfig, getAllConfig, getChildLocations, getChildren, getConfig, getConfigBag, getDisplayName, getExtension, getHostGeoInfo, getId, getLocationProperty, getManagementContext, getName, getParent, getParentLocation, getRawLocalConfigBag, getRebindSupport, hasConfig, hasConfig, hasExtension, hasLocationProperty, hashCode, init, isLegacyConstruction, isManaged, onManagementStarted, onManagementStopped, removeChild, removeChildLocation, setConfig, setHostGeoInfo, setManagementContext, setName, setParent, setParentLocation, string, toMetadataRecord, toString, toVerboseString
 

Field Detail

inUse

protected Set pendingRemoval;
protected java.util.Set inUse


machines

protected Set inUse;
protected java.util.Set machines


pendingRemoval

this(Maps.newLinkedHashMap());
protected java.util.Set pendingRemoval


 
Constructor Detail

FixedListMachineProvisioningLocation

public FixedListMachineProvisioningLocation()


FixedListMachineProvisioningLocation

public FixedListMachineProvisioningLocation(java.util.Map properties)


 
Method Detail

addChild

public void addChild(Location child)


addMachine

public void addMachine(java.lang.Object machine)


canProvisionMore

protected boolean canProvisionMore()


close

}
public void close()


configure

inUse = Sets.newLinkedHashSet();
public void configure(java.util.Map properties)


getAllMachines

public java.util.Set getAllMachines()


getAvailable

public java.util.Set getAvailable()


getInUse

public java.util.Set getInUse()


getMachines

protected java.util.Set getMachines()


getProvisioningFlags

/**
public java.util.Map getProvisioningFlags(java.util.Collection tags)


init

// FIXME Bad casting
public void init()


newSubLocation

public FixedListMachineProvisioningLocation newSubLocation(java.util.Map newFlags)


obtain

public java.lang.Object obtain()


obtain

synchronized (lock) {
public java.lang.Object obtain(java.util.Map flags)


provisionMore

protected void provisionMore(int size)


provisionMore

protected void provisionMore(int size, java.util.Map flags)


release

inUse.remove(machine);
public void release(java.lang.Object machine)


removeChild

machines.remove(child);
protected boolean removeChild(Location child)


removeMachine

public void removeMachine(java.lang.Object machine)


toVerboseString

.toString();
public java.lang.String toVerboseString()


 

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