Brooklyn

brooklyn.location.basic
[Java] Class AbstractLocation

java.lang.Object
  brooklyn.location.basic.AbstractLocation
All Implemented Interfaces:
Configurable, HasHostGeoInfo, LocationInternal

public abstract class AbstractLocation

A basic implementation of the Location interface. This provides an implementation which works according to the requirements of the interface documentation, and is ready to be extended to make more specialized locations. Override configure(Map) to add special initialization logic.


Field Summary
static Logger LOG

static ConfigKey PARENT_LOCATION

protected HostGeoInfo hostGeoInfo

protected java.lang.String name

 
Constructor Summary
AbstractLocation()

Construct a new instance of an AbstractLocation.

AbstractLocation(java.util.Map properties)

Construct a new instance of an AbstractLocation.

 
Method Summary
protected java.lang.Object addChild(LocationSpec spec)

void addChild(Location child)

void addChildLocation(Location child)

void addExtension(java.lang.Class extensionType, java.lang.Object extension)

protected void assertNotYetManaged()

void configure(java.util.Map properties)

Will set fields from flags.

boolean containsLocation(Location potentialDescendent)

boolean equals(java.lang.Object o)

java.lang.Object findLocationProperty(java.lang.String key)

override this, adding to the returned value, to supply additional fields to include in the toString

java.util.Map getAllConfig()

java.util.Map getAllConfig(boolean includeInherited)

@deprecated since 0.6.0 use getRawLocalConfigBag()

java.util.Collection getChildLocations()

java.util.Collection getChildren()

java.lang.Object getConfig(ConfigKey key)

ConfigBag getConfigBag()

java.lang.String getDisplayName()

java.lang.Object getExtension(java.lang.Class extensionType)

HostGeoInfo getHostGeoInfo()

java.lang.String getId()

Since:
0.6.0 (?)

java.lang.Object getLocationProperty(java.lang.String key)

protected ManagementContext getManagementContext()

java.lang.String getName()

Location getParent()

Location getParentLocation()

ConfigBag getRawLocalConfigBag()

RebindSupport getRebindSupport()

boolean hasConfig(ConfigKey key)

boolean hasConfig(ConfigKey key, boolean includeInherited)

boolean hasExtension(java.lang.Class extensionType)

boolean hasLocationProperty(java.lang.String key)

Default String representation is simplified name of class, together with selected fields.

int hashCode()

void init()

protected boolean isLegacyConstruction()

boolean isManaged()

void onManagementStarted()

void onManagementStopped()

protected boolean removeChild(Location child)

protected boolean removeChildLocation(Location child)

@deprecated since 0.6

java.lang.Object setConfig(ConfigKey key, java.lang.Object value)

void setHostGeoInfo(HostGeoInfo hostGeoInfo)

void setManagementContext(ManagementContext managementContext)

void setName(java.lang.String name)

void setParent(Location parent)

void setParentLocation(Location parent)

protected ToStringHelper string()

java.util.Map toMetadataRecord()

java.lang.String toString()

java.lang.String toVerboseString()

 
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

LOG

public static final Logger LOG


PARENT_LOCATION

public static final ConfigKey PARENT_LOCATION


hostGeoInfo

protected HostGeoInfo hostGeoInfo


name

protected java.lang.String name


 
Constructor Detail

AbstractLocation

public AbstractLocation()
Construct a new instance of an AbstractLocation.


AbstractLocation

public AbstractLocation(java.util.Map properties)
Construct a new instance of an AbstractLocation. The properties map recognizes the following keys: Other common properties (retrieved via get/findLocationProperty) include:


 
Method Detail

addChild

protected java.lang.Object addChild(LocationSpec spec)


addChild

public void addChild(Location child)


addChildLocation

// instances.
public void addChildLocation(Location child)


addExtension

public void addExtension(java.lang.Class extensionType, java.lang.Object extension)


assertNotYetManaged

protected void assertNotYetManaged()


configure

public void configure(java.util.Map properties)
Will set fields from flags. The unused configuration can be found via the {
linkplain:
ConfigBag#getUnusedConfig()}. This can be overridden for custom initialization but note the following.

For new-style locations (i.e. not calling constructor directly, this will be invoked automatically by brooklyn-core post-construction).

For legacy location use, this will be invoked by the constructor in this class. Therefore if over-riding 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.) If you require fields to be initialized you must do that in this method with a guard (as in FixedListMachineProvisioningLocation).


containsLocation

public boolean containsLocation(Location potentialDescendent)


equals

while (loc != null) {
public boolean equals(java.lang.Object o)


findLocationProperty

return Objects.toStringHelper(getClass()).add("id", id).add("name", name);
}
public java.lang.Object findLocationProperty(java.lang.String key)
override this, adding to the returned value, to supply additional fields to include in the toString


getAllConfig

/** @deprecated since 0.6.0 use {@link #getRawLocalConfigBag()} */
public java.util.Map getAllConfig()


getAllConfig

public ConfigBag getRawLocalConfigBag() {
public java.util.Map getAllConfig(boolean includeInherited)
deprecated:
since 0.6.0 use getRawLocalConfigBag()


getChildLocations

@Override
@Deprecated
public java.util.Collection getChildLocations()


getChildren

}
public java.util.Collection getChildren()


getConfig

}
public java.lang.Object getConfig(ConfigKey key)


getConfigBag

public ConfigBag getConfigBag()


getDisplayName

return parentLocation;
public java.lang.String getDisplayName()


getExtension


public java.lang.Object getExtension(java.lang.Class extensionType)


getHostGeoInfo

public HostGeoInfo getHostGeoInfo()


getId

return getDisplayName();
public java.lang.String getId()
Since:
0.6.0 (?) - use getDisplayName


getLocationProperty

}

public java.lang.Object getLocationProperty(java.lang.String key)


getManagementContext

protected ManagementContext getManagementContext()


getName

synchronized (childLocations) {
return ImmutableList.copyOf(childLocations);
        }
public java.lang.String getName()


getParent

if (parent == this) {
public Location getParent()


getParentLocation

@Override
public  T getConfig(ConfigKey key) {
public Location getParentLocation()


getRawLocalConfigBag

public ConfigBag getRawLocalConfigBag()


getRebindSupport

builder.put("id", getId());
public RebindSupport getRebindSupport()


hasConfig

}
@Override
public boolean hasConfig(ConfigKey key)


hasConfig

Location p = getParent();
public boolean hasConfig(ConfigKey key, boolean includeInherited)


hasExtension

public boolean hasExtension(java.lang.Class extensionType)


hasLocationProperty

@Override
public boolean hasLocationProperty(java.lang.String key)
Default String representation is simplified name of class, together with selected fields.


hashCode

*/
public int hashCode()


init

public void init()


isLegacyConstruction

protected boolean isLegacyConstruction()


isManaged

public boolean isManaged()


onManagementStarted

public void onManagementStarted()


onManagementStopped

public void onManagementStopped()


removeChild

protected boolean removeChild(Location child)


removeChildLocation

protected boolean removeChildLocation(Location child)
deprecated:
since 0.6
See Also:
removeChild(Location)


setConfig

public java.lang.Object setConfig(ConfigKey key, java.lang.Object value)


setHostGeoInfo

public void setHostGeoInfo(HostGeoInfo hostGeoInfo)


setManagementContext

public void setManagementContext(ManagementContext managementContext)


setName

public void setName(java.lang.String name)


setParent

}
public void setParent(Location parent)


setParentLocation

public boolean hasConfig(ConfigKey key, boolean includeInherited) {
boolean locally = getRawLocalConfigBag().containsKey(key);
public void setParentLocation(Location parent)


string

protected ToStringHelper string()


toMetadataRecord

public java.util.Map toMetadataRecord()


toString

public java.lang.String toString()


toVerboseString

public java.lang.String toVerboseString()


 

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