brooklyn.location
Interface Location

All Superinterfaces:
Identifiable, Rebindable, Serializable
All Known Subinterfaces:
AddressableLocation, MachineLocation, MachineProvisioningLocation<T>

public interface Location
extends Serializable, Identifiable, Rebindable

A location that an entity can be in. Examples of locations include a single machine or a pool of machines, or a region within a given cloud. See brooklyn.entity.trait.Startable#start(Collection). Locations may not be Serializable in subsequent releases!


Method Summary
 boolean containsLocation(Location potentialDescendent)
          Answers true if this location equals or is an ancestor of the given location.
 Object findLocationProperty(String key)
          Deprecated. since 0.5.0, use getConfig
 Map<String,Object> getAllConfig()
          Deprecated. since 0.6.0 use {@link #getAllConfig(boolean)
 Map<String,Object> getAllConfig(boolean includeInherited)
          Returns all config set, either inherited (argument true) or locally-only (argument false)
 Collection<Location> getChildLocations()
          Deprecated. since 0.6
 Collection<Location> getChildren()
          Get the 'children' of this location.
<T> T
getConfig(brooklyn.config.ConfigKey<T> key)
          Returns configuration set at this location or inherited or default
 String getDisplayName()
          Get the name assigned to this location.
<T> T
getExtension(Class<T> extensionType)
          Returns an extension of the given type.
 String getId()
          A unique id for this location.
 Object getLocationProperty(String key)
          Deprecated. since 0.5.0, use `if (hasConfig) { getConfig }` if you really need to preserve "don't look at parents" behaviour
 String getName()
          Deprecated. since 0.6
 Location getParent()
          Get the 'parent' of this location.
 Location getParentLocation()
          Deprecated. since 0.6
 RebindSupport<LocationMemento> getRebindSupport()
           
 boolean hasConfig(brooklyn.config.ConfigKey<?> key)
          Deprecated. since 0.6.0 use hasConfig(ConfigKey, boolean)
 boolean hasConfig(brooklyn.config.ConfigKey<?> key, boolean includeInherited)
          True iff the indication config key is set, either inherited (second argument true) or locally-only (second argument false)
 boolean hasExtension(Class<?> extensionType)
          Whether this location has support for the given extension type.
 boolean hasLocationProperty(String key)
          Deprecated. since 0.5.0, use hasConfig
 void setParent(Location newParent)
          Set the 'parent' of this location.
 void setParentLocation(Location newParent)
          Deprecated. since 0.6
 String toVerboseString()
           
 

Method Detail

getId

String getId()
A unique id for this location.

Specified by:
getId in interface Identifiable

getDisplayName

String getDisplayName()
Get the name assigned to this location.

Returns:
the name assigned to the location.
Since:
0.6 (previously getName())

getParent

Location getParent()
Get the 'parent' of this location. Locations are organized into a tree hierarchy, and this method will return a reference to the parent of this location, or null if this location is the tree root.

Returns:
a reference to the parent of this location, or null if this location is the tree root.
Since:
0.6 (previously getParentLocation())

getChildren

Collection<Location> getChildren()
Get the 'children' of this location. Locations are organized into a tree hierarchy, and this method will return a collection containing the children of this location. This collection is an unmodifiable view of the data.

Returns:
a collection containing the children of this location.
Since:
0.6 (previously getChildLocations())

getName

@Deprecated
String getName()
Deprecated. since 0.6

See Also:
getDisplayName()

getParentLocation

@Deprecated
Location getParentLocation()
Deprecated. since 0.6

See Also:
getParent()

setParent

void setParent(Location newParent)
Set the 'parent' of this location. If this location was previously a child of a different location, it is removed from the other location first. It is valid to pass in null to indicate that the location should be disconnected from its parent. Adds this location as a child of the new parent (see getChildLocations()).

Parameters:
newParent - the new parent location object, or null to clear the parent reference.
Since:
0.6 (previously setParentLocation(Location))

setParentLocation

@Deprecated
void setParentLocation(Location newParent)
Deprecated. since 0.6

See Also:
setParent(Location)

getChildLocations

@Deprecated
Collection<Location> getChildLocations()
Deprecated. since 0.6

See Also:
getChildren()

toVerboseString

String toVerboseString()
Returns:
meta-data about the location (usually a long line, or a small number of lines).
Since:
0.6

containsLocation

boolean containsLocation(Location potentialDescendent)
Answers true if this location equals or is an ancestor of the given location.


getConfig

<T> T getConfig(brooklyn.config.ConfigKey<T> key)
Returns configuration set at this location or inherited or default


hasConfig

@Deprecated
boolean hasConfig(brooklyn.config.ConfigKey<?> key)
Deprecated. since 0.6.0 use hasConfig(ConfigKey, boolean)

True iff the indication config key is set _at_ this location (not parents)


getAllConfig

@Deprecated
Map<String,Object> getAllConfig()
Deprecated. since 0.6.0 use {@link #getAllConfig(boolean)

Returns all config set _at_ this location (not inherited)


hasConfig

boolean hasConfig(brooklyn.config.ConfigKey<?> key,
                  boolean includeInherited)
True iff the indication config key is set, either inherited (second argument true) or locally-only (second argument false)


getAllConfig

Map<String,Object> getAllConfig(boolean includeInherited)
Returns all config set, either inherited (argument true) or locally-only (argument false)


hasLocationProperty

@Deprecated
boolean hasLocationProperty(String key)
Deprecated. since 0.5.0, use hasConfig

Returns true iff this location contains a property with the specified key. The property's value can be obtained by calling getLocationProperty(java.lang.String). This method only interrogates the immediate properties; the parent hierarchy is NOT searched in the event that the property is not found locally.


getLocationProperty

@Deprecated
Object getLocationProperty(String key)
Deprecated. since 0.5.0, use `if (hasConfig) { getConfig }` if you really need to preserve "don't look at parents" behaviour

Returns the value of the property identified by the specified key. This method only interrogates the immediate properties; the parent hierarchy is NOT searched in the event that the property is not found locally. NOTE: must not name this method 'getProperty' as this will clash with the 'magic' Groovy's method of the same name, at which point everything stops working!


findLocationProperty

@Deprecated
Object findLocationProperty(String key)
Deprecated. since 0.5.0, use getConfig

Like getLocationProperty(java.lang.String), but if the property is not defined on this location, searches recursively up the parent hierarchy until it is found, or the root is reached (when this method will return null).


getRebindSupport

RebindSupport<LocationMemento> getRebindSupport()
Specified by:
getRebindSupport in interface Rebindable

hasExtension

boolean hasExtension(Class<?> extensionType)
Whether this location has support for the given extension type. See additional comments in getExtension(Class).

Throws:
NullPointerException - if extensionType is null

getExtension

<T> T getExtension(Class<T> extensionType)
Returns an extension of the given type. Note that the type must be an exact match for how the extension was registered (e.g. getExtension(Object.class) will not match anything, even though registered extension extend Object.

This will not look at extensions of getParent().

Throws:
IllegalArgumentException - if this location does not support the given extension type
NullPointerException - if extensionType is null


Copyright © 2013. All Rights Reserved.