Brooklyn

brooklyn.entity.basic
[Java] Interface EntityLocal

brooklyn.entity.basic.EntityLocal
  brooklyn.entity.Entity
All Superinterfaces:
Entity

public interface EntityLocal
extends Entity

Extended Entity interface for use in places where the caller should have certain privileges, such as setting attribute values, adding policies, etc.


Method Summary
void addEnricher(AbstractEnricher enricher)

Adds the given enricher to this entity.

void addPolicy(AbstractPolicy policy)

Adds the given policy to this entity.

void emit(Sensor sensor, java.lang.Object value)

Emits a SensorEvent event on behalf of this entity (as though produced by this entity).

java.lang.Object getConfig(ConfigKey key, java.lang.Object defaultValue)

java.lang.Object getConfig(HasConfigKey key)

java.lang.Object getConfig(HasConfigKey key, java.lang.Object defaultValue)

ExecutionContext getExecutionContext()

@return The task execution context for the entity, or null if it is not yet managed.

ManagementContext getManagementContext()

@return The management context for the entity, or null if it is not yet managed.

boolean removeAllEnrichers()

Removes all enricher from this entity.

boolean removeAllPolicies()

Removes all policy from this entity.

boolean removeEnricher(AbstractEnricher enricher)

Removes the given enricher from this entity.

boolean removePolicy(AbstractPolicy policy)

Removes the given policy from this entity.

java.lang.Object setAttribute(AttributeSensor sensor, java.lang.Object val)

Sets the Sensor data for the given attribute to the specified value.

java.lang.Object setConfig(ConfigKey key, java.lang.Object val)

Must be called before the entity is started.

java.lang.Object setConfig(HasConfigKey key, java.lang.Object val)

SubscriptionHandle subscribe(Entity producer, Sensor sensor, SensorEventListener listener)

Allow us to subscribe to data from a Sensor on another entity.

SubscriptionHandle subscribeToChildren(Entity parent, Sensor sensor, SensorEventListener listener)

@see SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)

 
Methods inherited from interface Entity
addGroup, addOwnedChild, clearOwner, getApplication, getApplicationId, getAttribute, getConfig, getDisplayName, getEnrichers, getEntityType, getGroups, getId, getLocations, getOwnedChildren, getOwner, getPolicies, invoke, removeOwnedChild, setOwner
 

Method Detail

addEnricher

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


addPolicy

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


emit

public void emit(Sensor sensor, java.lang.Object value)
Emits a SensorEvent event on behalf of this entity (as though produced by this entity).

Note that for attribute sensors it is nearly always recommended to use setAttribute, as this method will not update local values.


getConfig

public java.lang.Object getConfig(ConfigKey key, java.lang.Object defaultValue)


getConfig

public java.lang.Object getConfig(HasConfigKey key)


getConfig

public java.lang.Object getConfig(HasConfigKey key, java.lang.Object defaultValue)


getExecutionContext

public ExecutionContext getExecutionContext()
Returns:
The task execution context for the entity, or null if it is not yet managed.


getManagementContext

public ManagementContext getManagementContext()
Returns:
The management context for the entity, or null if it is not yet managed.


removeAllEnrichers

public boolean removeAllEnrichers()
Removes all enricher from this entity. Use with caution as some entities automatically register enrichers; this will remove those enrichers as well.
Returns:
True if any enrichers existed at this entity; false otherwise


removeAllPolicies

public boolean removeAllPolicies()
Removes all policy from this entity.
Returns:
True if any policies existed at this entity; false otherwise


removeEnricher

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


removePolicy

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


setAttribute

public java.lang.Object setAttribute(AttributeSensor sensor, java.lang.Object val)
Sets the Sensor data for the given attribute to the specified value. This can be used to "enrich" the entity, such as adding aggregated information, rolling averages, etc.
Returns:
the old value for the attribute (possibly null)


setConfig

public java.lang.Object setConfig(ConfigKey key, java.lang.Object val)
Must be called before the entity is started.


setConfig

public java.lang.Object setConfig(HasConfigKey key, java.lang.Object val)


subscribe

public SubscriptionHandle subscribe(Entity producer, Sensor sensor, SensorEventListener listener)
Allow us to subscribe to data from a Sensor on another entity.
Returns:
a subscription id which can be used to unsubscribe
See Also:
SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)#subscribe(Map, Entity, Sensor, SensorEventListener)


subscribeToChildren

public SubscriptionHandle subscribeToChildren(Entity parent, Sensor sensor, SensorEventListener listener)
See Also:
SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)


 

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