Brooklyn

brooklyn.location
[Java] Interface Location


public interface Location
extends java.io.Serializable

Location.


Method Summary
boolean containsLocation(Location potentialDescendent)

Answers true if this location equals or is an ancestor of the given location.

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

Like getLocationProperty, 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).

java.util.Collection getChildLocations()

Get the 'children' of this location.

java.lang.String getId()

A unique id for this location.

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

Returns the value of the property identified by the specified key.

java.lang.String getName()

Get the name assigned to this location.

Location getParentLocation()

Get the 'parent' of this location.

boolean hasLocationProperty(java.lang.String key)

TODO Return the ISO-3166 country code.

void setParentLocation(Location newParent)

Set the 'parent' of this location.

 
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()
 

Method Detail

containsLocation

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


findLocationProperty

public java.lang.Object findLocationProperty(java.lang.String key)
Like getLocationProperty, 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).


getChildLocations

public java.util.Collection 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.


getId

public java.lang.String getId()
A unique id for this location.


getLocationProperty

public java.lang.Object getLocationProperty(java.lang.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!


getName

public java.lang.String getName()
Get the name assigned to this location.
Returns:
the name assigned to the location.


getParentLocation

public 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.


hasLocationProperty

public boolean hasLocationProperty(java.lang.String key)
TODO Return the ISO-3166 country code. TODO A location could be in multiple iso-3166-2 locations.


setParentLocation

public 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.
Parameters:
newParent - the new parent location object, or null to clear the parent reference.


 

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