brooklyn.entity
Interface Entity

All Superinterfaces:
Identifiable, Rebindable
All Known Subinterfaces:
Application, DriverDependentEntity<D>, EntityLocal, Group

public interface Entity
extends Identifiable, Rebindable

The basic interface for a Brooklyn entity.

Implementors of entities are strongly encouraged to extend brooklyn.entity.basic.AbstractEntity.

To instantiate an entity, see managementContext.getEntityManager().createEntity(entitySpec). Also see brooklyn.entity.basic.ApplicationBuilder, brooklyn.entity.basic.AbstractEntity#addChild(EntitySpec), and brooklyn.entity.proxying.EntitySpecs.

See Also:
brooklyn.entity.basic.AbstractEntity

Method Summary
<T extends Entity>
T
addChild(EntitySpec<T> spec)
          Creates an Entity from the given spec and adds it, setting this entity as the parent, returning the added child.
<T extends Entity>
T
addChild(T child)
          Add a child Entity, and set this entity as its parent, returning the added child.
 void addEnricher(Enricher enricher)
          Adds the given enricher to this entity.
 void addGroup(Group group)
          Add this entity as a member of the given Group.
 void addPolicy(Policy policy)
          Adds the given policy to this entity.
 void clearParent()
          Clears the parent (i.e.
 Application getApplication()
           
 String getApplicationId()
           
<T> T
getAttribute(AttributeSensor<T> sensor)
          Gets the value of the given attribute on this entity, or null if has not been set.
 Collection<Entity> getChildren()
          Return the entities that are children of (i.e.
<T> T
getConfig(brooklyn.config.ConfigKey.HasConfigKey<T> key)
           
<T> T
getConfig(brooklyn.config.ConfigKey<T> key)
          Gets the given configuration value for this entity, in the following order of preference: value (including null) explicitly set on the entity value (including null) explicitly set on an ancestor (inherited) a default value (including null) on the best equivalent static key of the same name declared on the entity (where best equivalence is defined as preferring a config key which extends another, as computed in EntityDynamicType.getConfigKeys) a default value (including null) on the key itself null
 long getCreationTime()
          Returns the creation time for this entity, in UTC.
 String getDisplayName()
          A display name; recommended to be a concise single-line description.
 Collection<Enricher> getEnrichers()
           
 EntityType getEntityType()
          Information about the type of this entity; analogous to Java's object.getClass.
 Collection<Group> getGroups()
          The Collection of Groups that this entity is a member of.
 String getIconUrl()
          A URL pointing to an image which can be used to represent this icon.
 String getId()
          The unique identifier for this entity.
 Collection<Location> getLocations()
          Return all the Locations this entity is deployed to.
 Entity getParent()
          The parent of this entity, null if no parent.
 Collection<Policy> getPolicies()
           
 RebindSupport<EntityMemento> getRebindSupport()
           
<T> Task<T>
invoke(Effector<T> eff, Map<String,?> parameters)
          Invokes the given effector, with the given parameters to that effector.
 boolean removeChild(Entity child)
          Removes the specified child Entity; its parent will be set to null.
 boolean removeEnricher(Enricher enricher)
          Removes the given enricher from this entity.
 boolean removePolicy(Policy policy)
          Removes the given policy from this entity.
 Entity setParent(Entity parent)
          Sets the parent (i.e.
 

Method Detail

getId

String getId()
The unique identifier for this entity.

Specified by:
getId in interface Identifiable

getCreationTime

long getCreationTime()
Returns the creation time for this entity, in UTC.


getDisplayName

String getDisplayName()
A display name; recommended to be a concise single-line description.


getIconUrl

@Nullable
String getIconUrl()
A URL pointing to an image which can be used to represent this icon.


getEntityType

EntityType getEntityType()
Information about the type of this entity; analogous to Java's object.getClass.


getApplication

Application getApplication()
Returns:
the Application this entity is registered with, or null if not registered.

getApplicationId

String getApplicationId()
Returns:
the id of the Application this entity is registered with, or null if not registered.

getParent

Entity getParent()
The parent of this entity, null if no parent. The parent is normally the entity responsible for creating/destroying/managing this entity.

See Also:
setParent(Entity), clearParent()

getChildren

Collection<Entity> getChildren()
Return the entities that are children of (i.e. "owned by") this entity


setParent

Entity setParent(Entity parent)
Sets the parent (i.e. "owner") of this entity. Returns this entity, for convenience.

See Also:
getParent(), clearParent()

clearParent

void clearParent()
Clears the parent (i.e. "owner") of this entity. Also cleans up any references within its parent entity.

See Also:
getParent(), setParent(brooklyn.entity.Entity)

addChild

<T extends Entity> T addChild(T child)
Add a child Entity, and set this entity as its parent, returning the added child.


addChild

<T extends Entity> T addChild(EntitySpec<T> spec)
Creates an Entity from the given spec and adds it, setting this entity as the parent, returning the added child.


removeChild

boolean removeChild(Entity child)
Removes the specified child Entity; its parent will be set to null.

Returns:
True if the given entity was contained in the set of children

getPolicies

Collection<Policy> getPolicies()
Returns:
an immutable thread-safe view of the policies.

getEnrichers

Collection<Enricher> getEnrichers()
Returns:
an immutable thread-safe view of the enrichers.

getGroups

Collection<Group> getGroups()
The Collection of Groups that this entity is a member of. Groupings can be used to allow easy management/monitoring of a group of entities.


addGroup

void addGroup(Group group)
Add this entity as a member of the given Group.


getLocations

Collection<Location> getLocations()
Return all the Locations this entity is deployed to.


getAttribute

<T> T getAttribute(AttributeSensor<T> sensor)
Gets the value of the given attribute on this entity, or null if has not been set. Attributes can be things like workrate and status information, as well as configuration (e.g. url/jmxHost/jmxPort), etc.


getConfig

<T> T getConfig(brooklyn.config.ConfigKey<T> key)
Gets the given configuration value for this entity, in the following order of preference:
  • value (including null) explicitly set on the entity
  • value (including null) explicitly set on an ancestor (inherited)
  • a default value (including null) on the best equivalent static key of the same name declared on the entity (where best equivalence is defined as preferring a config key which extends another, as computed in EntityDynamicType.getConfigKeys)
  • a default value (including null) on the key itself
  • null


  • getConfig

    <T> T getConfig(brooklyn.config.ConfigKey.HasConfigKey<T> key)

    invoke

    <T> Task<T> invoke(Effector<T> eff,
                       Map<String,?> parameters)
    Invokes the given effector, with the given parameters to that effector.


    addPolicy

    void addPolicy(Policy policy)
    Adds the given policy to this entity. Also calls policy.setEntity if available.


    removePolicy

    boolean removePolicy(Policy policy)
    Removes the given policy from this entity.

    Returns:
    True if the policy existed at this entity; false otherwise

    addEnricher

    void addEnricher(Enricher enricher)
    Adds the given enricher to this entity. Also calls enricher.setEntity if available.


    removeEnricher

    boolean removeEnricher(Enricher enricher)
    Removes the given enricher from this entity.

    Returns:
    True if the policy enricher at this entity; false otherwise

    getRebindSupport

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


    Copyright © 2013. All Rights Reserved.