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.| Modifier and Type | Class and Description |
|---|---|
class |
AbstractLocation.BasicSubscriptionSupport |
BrooklynObjectInternal.ConfigurationSupportInternal, BrooklynObjectInternal.RelationSupportInternal<T extends BrooklynObject>, BrooklynObjectInternal.SubscriptionSupportInternalBrooklynObject.RelationSupport<T extends BrooklynObject>, BrooklynObject.SubscriptionSupport, BrooklynObject.TagSupportConfigurable.ConfigurationSupport| Modifier and Type | Field and Description |
|---|---|
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.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)
Convenience for calling
Configurable.ConfigurationSupport.get(ConfigKey),
via code like config().get(key). |
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() |
LocationDynamicType |
getLocationTypeInternal() |
Location |
getParent()
Get the 'parent' of this location.
|
RebindSupport<LocationMemento> |
getRebindSupport()
Users are strongly discouraged from calling or overriding this method.
|
boolean |
hasExtension(java.lang.Class<?> extensionType)
Whether this location has support for the given extension type.
|
int |
hashCode() |
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.
|
boolean |
isManaged() |
void |
onManagementStarted() |
void |
onManagementStopped() |
void |
rebind()
Called by framework on rebind (in new-style instances):
after configuring, but
before the instance is managed, and
before adjuncts are attached to entities, and
before a reference to an object is shared.
|
BrooklynObjectInternal.RelationSupportInternal<Location> |
relations()
Relations specify a typed, directed connection between two entities.
|
boolean |
removeChild(Location child) |
void |
setDisplayName(java.lang.String newName) |
void |
setHostGeoInfo(HostGeoInfo hostGeoInfo) |
void |
setManagementContext(ManagementContextInternal managementContext) |
void |
setParent(Location newParent)
Set the 'parent' of this location.
|
void |
setParent(Location newParent,
boolean updateChildListParents) |
AbstractLocation.BasicSubscriptionSupport |
subscriptions()
Subscriptions are the mechanism for receiving notifications of sensor-events (e.g.
|
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() |
addSearchPath, getCatalogItemId, getCatalogItemIdSearchPath, getId, getManagementContext, setCatalogItemId, setCatalogItemIdAndSearchPath, stackCatalogItemId, tagsgetManagementContextaddSearchPath, setCatalogItemId, setCatalogItemIdAndSearchPath, stackCatalogItemIdgetCatalogItemId, getCatalogItemIdSearchPath, tagspublic 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)
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.)
public boolean isManaged()
public void onManagementStarted()
public void onManagementStopped()
public java.lang.String getDisplayName()
BrooklynObjectgetDisplayName in interface LocationgetDisplayName in interface BrooklynObjectpublic Location getParent()
Locationnull if this location is the tree root.public java.util.Collection<Location> getChildren()
LocationgetChildren in interface Locationpublic void setParent(Location newParent)
Locationnull 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 Configurableconfig in interface BrooklynObjectInternalpublic AbstractLocation.BasicSubscriptionSupport subscriptions()
BrooklynObjectsubscriptions in interface BrooklynObjectsubscriptions in interface BrooklynObjectInternalpublic <T> T getConfig(ConfigKey.HasConfigKey<T> key)
Locationconfig().get(key)public <T> T getConfig(ConfigKey<T> key)
ConfigurableConfigurable.ConfigurationSupport.get(ConfigKey),
via code like config().get(key).getConfig in interface Configurablepublic void setDisplayName(java.lang.String newName)
setDisplayName in class AbstractBrooklynObjectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean containsLocation(Location potentialDescendent)
LocationcontainsLocation in interface Locationpublic void addChild(Location child)
public boolean removeChild(Location child)
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 void rebind()
AbstractBrooklynObjectAbstractBrooklynObject.init() will not be called on rebind.
If you need to intercept behaviour after adjuncts are attached,
consider AbstractEntity.onManagementStarting()
(but probably worth raising a discussion on the mailing list!)
rebind in class AbstractBrooklynObjectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toVerboseString()
toVerboseString in interface Locationpublic HostGeoInfo getHostGeoInfo()
getHostGeoInfo in interface HasHostGeoInfopublic void setHostGeoInfo(HostGeoInfo hostGeoInfo)
public RebindSupport<LocationMemento> getRebindSupport()
LocationInternalgetRebindSupport in interface RebindablegetRebindSupport in interface LocationInternalgetRebindSupport in interface BrooklynObjectInternalpublic LocationDynamicType getLocationTypeInternal()
public BrooklynObjectInternal.RelationSupportInternal<Location> relations()
BrooklynObjectrelations in interface Locationrelations in interface BrooklynObjectrelations in interface LocationInternalrelations in interface BrooklynObjectInternalrelations in class AbstractBrooklynObjectpublic boolean hasExtension(java.lang.Class<?> extensionType)
LocationLocation.getExtension(Class).hasExtension in interface Locationpublic <T> T getExtension(java.lang.Class<T> extensionType)
LocationgetExtension(Object.class) will not match
anything, even though registered extension extend Object.
This will not look at extensions of Location.getParent().
getExtension in interface Locationpublic <T> void addExtension(java.lang.Class<T> extensionType,
T extension)
LocationInternaladdExtension in interface LocationInternalpublic java.util.Map<java.lang.String,java.lang.String> toMetadataRecord()
LocationInternalMetadata 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