Brooklyn

brooklyn.entity
[Java] Interface Entity

brooklyn.entity.rebind.Rebindable
  brooklyn.entity.Entity
      brooklyn.entity.trait.Identifiable
All Superinterfaces:
Rebindable, Identifiable

public interface Entity
extends Identifiable, Rebindable

The basic interface for a Brooklyn entity.

Implementors of entities are strongly encouraged to extend AbstractEntity.

To instantiate an entity, see managementContext.getEntityManager().createEntity(entitySpec). Also see ApplicationBuilder, AbstractEntity.addChild, and EntitySpecs.

See Also:
AbstractEntity


Method Summary
java.lang.Object addChild(java.lang.Object child)

Add a child Entity, and set this entity as its parent, returning the added child.

java.lang.Object addChild(EntitySpec spec)

Creates an Entity from the given spec and adds it, setting this entity as the 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()

@return the Application this entity is registered with, or null if not registered.

java.lang.String getApplicationId()

@return the id of the Application this entity is registered with, or null if not registered.

java.lang.Object getAttribute(AttributeSensor sensor)

Gets the value of the given attribute on this entity, or null if has not been set.

java.util.Collection getChildren()

Return the entities that are children of (i.e.

java.lang.Object getConfig(ConfigKey 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

  • java.lang.Object getConfig(HasConfigKey key)

    long getCreationTime()

    Returns the creation time for this entity, in UTC.

    java.lang.String getDisplayName()

    A display name; recommended to be a concise single-line description.

    java.util.Collection getEnrichers()

    @return an immutable thread-safe view of the enrichers.

    EntityType getEntityType()

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

    java.util.Collection getGroups()

    The java.util.Collection of Groups that this entity is a member of.

    java.lang.String getIconUrl()

    A URL pointing to an image which can be used to represent this icon.

    java.lang.String getId()

    The unique identifier for this entity.

    java.util.Collection getLocations()

    Return all the Locations this entity is deployed to.

    Entity getParent()

    The parent of this entity, null if no parent.

    java.util.Collection getPolicies()

    @return an immutable thread-safe view of the policies.

    RebindSupport getRebindSupport()

    Task invoke(Effector eff, java.util.Map 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.

     
    Methods inherited from interface Rebindable
    getRebindSupport
     
    Methods inherited from interface Identifiable
    getId
     

    Method Detail

    addChild

    public java.lang.Object addChild(java.lang.Object child)
    Add a child Entity, and set this entity as its parent, returning the added child.


    addChild

    public java.lang.Object addChild(EntitySpec spec)
    Creates an Entity from the given spec and adds it, setting this entity as the parent, returning the added child.


    addEnricher

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


    addGroup

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


    addPolicy

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


    clearParent

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


    getApplication

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


    getApplicationId

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


    getAttribute

    public java.lang.Object getAttribute(AttributeSensor 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.


    getChildren

    public java.util.Collection getChildren()
    Return the entities that are children of (i.e. "owned by") this entity


    getConfig

    public java.lang.Object getConfig(ConfigKey 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

    public java.lang.Object getConfig(HasConfigKey key)


    getCreationTime

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


    getDisplayName

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


    getEnrichers

    public java.util.Collection getEnrichers()
    Returns:
    an immutable thread-safe view of the enrichers.


    getEntityType

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


    getGroups

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


    getIconUrl

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


    getId

    @Override
    public java.lang.String getId()
    The unique identifier for this entity.


    getLocations

    public java.util.Collection getLocations()
    Return all the Locations this entity is deployed to.


    getParent

    public 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


    getPolicies

    public java.util.Collection getPolicies()
    Returns:
    an immutable thread-safe view of the policies.


    getRebindSupport

    @Override
    public RebindSupport getRebindSupport()


    invoke

    public Task invoke(Effector eff, java.util.Map parameters)
    Invokes the given effector, with the given parameters to that effector.


    removeChild

    public 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


    removeEnricher

    public boolean removeEnricher(Enricher enricher)
    Removes the given enricher from this entity.
    Returns:
    True if the policy enricher at this entity; false otherwise


    removePolicy

    public boolean removePolicy(Policy policy)
    Removes the given policy from this entity.
    Returns:
    True if the policy existed at this entity; false otherwise


    setParent

    public Entity setParent(Entity parent)
    Sets the parent (i.e. "owner") of this entity. Returns this entity, for convenience.
    See Also:
    getParent
    clearParent


     

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