brooklyn.location
Interface Location

All Superinterfaces:
Rebindable<LocationMemento>, Serializable
All Known Subinterfaces:
MachineProvisioningLocation<T>

public interface Location
extends Serializable, Rebindable<LocationMemento>

Location.


Method Summary
 boolean containsLocation(Location potentialDescendent)
          Answers true if this location equals or is an ancestor of the given location.
 Object findLocationProperty(String key)
          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).
 Collection<Location> getChildLocations()
          Get the 'children' of this location.
 String getId()
          A unique id for this location.
 Map<String,?> getLocationProperties()
          Returns the loction properties of this immediate location (i.e.
 Object getLocationProperty(String key)
          Returns the value of the property identified by the specified key.
 String getName()
          Get the name assigned to this location.
 Location getParentLocation()
          Get the 'parent' of this location.
 boolean hasLocationProperty(String key)
          Returns true iff this location contains a property with the specified key.
 void setParentLocation(Location newParent)
          Set the 'parent' of this location.
 
Methods inherited from interface brooklyn.entity.rebind.Rebindable
getRebindSupport
 

Method Detail

getId

String getId()
A unique id for this location.


getName

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

Returns:
the name assigned to the location.

getParentLocation

Location getParentLocation()
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.

getChildLocations

Collection<Location> getChildLocations()
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.

setParentLocation

void setParentLocation(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.

containsLocation

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


hasLocationProperty

boolean hasLocationProperty(String key)
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

Object getLocationProperty(String key)
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!


getLocationProperties

Map<String,?> getLocationProperties()
Returns the loction properties of this immediate location (i.e. not including those from the parent hierarchy).


findLocationProperty

Object findLocationProperty(String key)
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).



Copyright © 2013. All Rights Reserved.