public abstract class AbstractLocation extends AbstractBrooklynObject implements LocationInternal, HasHostGeoInfo, Configurable
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.BrooklynObjectInternal.ConfigurationSupportInternal
BrooklynObject.TagSupport
Configurable.ConfigurationSupport
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG
Deprecated.
since 0.7.0 shouldn't be public
|
static ConfigKey<Location> |
PARENT_LOCATION |
static ConfigKey<java.lang.Boolean> |
TEMPORARY_LOCATION |
FINAL_SPEC, NAMED_SPEC_NAME, ORIGINAL_SPEC
Constructor and Description |
---|
AbstractLocation()
Construct a new instance of an AbstractLocation.
|
AbstractLocation(java.util.Map<?,?> properties)
Construct a new instance of an AbstractLocation.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(Location child) |
<T> void |
addExtension(java.lang.Class<T> extensionType,
T extension)
Registers the given extension for the given type.
|
BrooklynObjectInternal.ConfigurationSupportInternal |
config() |
AbstractLocation |
configure(java.util.Map<?,?> properties)
Deprecated.
since 0.7.0; only used for legacy brooklyn types where constructor is called directly;
see overridden method for more info
|
boolean |
containsLocation(Location potentialDescendent)
Answers true if this location equals or is an ancestor of the given location.
|
boolean |
equals(java.lang.Object o) |
java.util.Map<java.lang.String,java.lang.Object> |
getAllConfig(boolean includeInherited)
Deprecated.
|
ConfigBag |
getAllConfigBag()
Deprecated.
|
java.util.Collection<Location> |
getChildren()
Get the 'children' of this location.
|
<T> T |
getConfig(ConfigKey.HasConfigKey<T> key)
Convenience method for
config().get(key) |
<T> T |
getConfig(ConfigKey<T> key)
Returns configuration set at this location or inherited or default.
|
java.lang.String |
getDisplayName()
A display name; recommended to be a concise single-line description.
|
<T> T |
getExtension(java.lang.Class<T> extensionType)
Returns an extension of the given type.
|
HostGeoInfo |
getHostGeoInfo() |
ConfigBag |
getLocalConfigBag() |
Location |
getParent()
Get the 'parent' of this location.
|
ConfigBag |
getRawLocalConfigBag()
Deprecated.
since 0.7; use
getLocalConfigBag() |
RebindSupport<LocationMemento> |
getRebindSupport()
Users are strongly discouraged from calling or overriding this method.
|
boolean |
hasConfig(ConfigKey<?> key,
boolean includeInherited)
Deprecated.
|
boolean |
hasExtension(java.lang.Class<?> extensionType)
Whether this location has support for the given extension type.
|
int |
hashCode() |
boolean |
isManaged() |
void |
onManagementStarted() |
void |
onManagementStopped() |
boolean |
removeChild(Location child) |
<T> T |
setConfig(ConfigKey<T> key,
T value)
Deprecated.
|
void |
setDisplayName(java.lang.String newName) |
void |
setHostGeoInfo(HostGeoInfo hostGeoInfo) |
void |
setManagementContext(ManagementContextInternal managementContext) |
void |
setName(java.lang.String newName)
Deprecated.
since 0.7.0; use
getDisplayName() |
void |
setParent(Location newParent)
Set the 'parent' of this location.
|
void |
setParent(Location newParent,
boolean updateChildListParents) |
java.util.Map<java.lang.String,java.lang.String> |
toMetadataRecord()
Get a record of the metadata of this location.
|
java.lang.String |
toString()
Default String representation is simplified name of class, together with selected fields.
|
java.lang.String |
toVerboseString() |
getCatalogItemId, getId, getManagementContext, getTagSupport, init, rebind, setCatalogItemId, tags
getManagementContext
setCatalogItemId
getCatalogItemId, getTagSupport, tags
@Deprecated public static final org.slf4j.Logger LOG
public static final ConfigKey<java.lang.Boolean> TEMPORARY_LOCATION
public AbstractLocation()
public AbstractLocation(java.util.Map<?,?> properties)
Location
public void setManagementContext(ManagementContextInternal managementContext)
setManagementContext
in class AbstractBrooklynObject
@Deprecated public AbstractLocation configure(java.util.Map<?,?> properties)
AbstractBrooklynObject
ConfigBag.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.)
public boolean isManaged()
public void onManagementStarted()
public void onManagementStopped()
public java.lang.String getDisplayName()
BrooklynObject
getDisplayName
in interface BrooklynObject
getDisplayName
in interface Location
public Location getParent()
Location
null
if this location is the tree root.public java.util.Collection<Location> getChildren()
Location
getChildren
in interface Location
public void setParent(Location newParent)
Location
null
to indicate that the location should be disconnected
from its parent.
Adds this location as a child of the new parent (see getChildLocations()
).public void setParent(Location newParent, boolean updateChildListParents)
public BrooklynObjectInternal.ConfigurationSupportInternal config()
config
in interface BrooklynObjectInternal
config
in interface Configurable
public <T> T getConfig(ConfigKey.HasConfigKey<T> key)
Location
config().get(key)
public <T> T getConfig(ConfigKey<T> key)
Location
config().get(key)
@Deprecated public boolean hasConfig(ConfigKey<?> key, boolean includeInherited)
Location
@Deprecated public java.util.Map<java.lang.String,java.lang.Object> getAllConfig(boolean includeInherited)
Location
getAllConfig
in interface Location
@Deprecated public ConfigBag getAllConfigBag()
LocationInternal
ConfigInheritance
and so usage is discouraged.getAllConfigBag
in interface LocationInternal
public ConfigBag getLocalConfigBag()
getLocalConfigBag
in interface LocationInternal
@Deprecated public ConfigBag getRawLocalConfigBag()
getLocalConfigBag()
@Deprecated public <T> T setConfig(ConfigKey<T> key, T value)
setConfig
in interface Configurable
@Deprecated public void setName(java.lang.String newName)
getDisplayName()
public void setDisplayName(java.lang.String newName)
setDisplayName
in class AbstractBrooklynObject
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean containsLocation(Location potentialDescendent)
Location
containsLocation
in interface Location
public void addChild(Location child)
public boolean removeChild(Location child)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toVerboseString()
toVerboseString
in interface Location
public HostGeoInfo getHostGeoInfo()
getHostGeoInfo
in interface HasHostGeoInfo
public void setHostGeoInfo(HostGeoInfo hostGeoInfo)
public RebindSupport<LocationMemento> getRebindSupport()
LocationInternal
getRebindSupport
in interface BrooklynObjectInternal
getRebindSupport
in interface Rebindable
getRebindSupport
in interface LocationInternal
public boolean hasExtension(java.lang.Class<?> extensionType)
Location
Location.getExtension(Class)
.hasExtension
in interface Location
public <T> T getExtension(java.lang.Class<T> extensionType)
Location
getExtension(Object.class)
will not match
anything, even though registered extension extend Object
.
This will not look at extensions of Location.getParent()
.
getExtension
in interface Location
public <T> void addExtension(java.lang.Class<T> extensionType, T extension)
LocationInternal
addExtension
in interface LocationInternal
public java.util.Map<java.lang.String,java.lang.String> toMetadataRecord()
LocationInternal
Metadata records are used to record an audit trail of events relating to location usage (for billing purposes, for example). Implementations (and subclasses) should override this method to return information useful for this purpose.
toMetadataRecord
in interface LocationInternal