brooklyn.entity.basic
Interface EntityLocal

All Superinterfaces:
Configurable, Entity, Identifiable, Rebindable

public interface EntityLocal
extends Entity, Configurable

Extended Entity interface for use in places where the caller should have certain privileges, such as setting attribute values, adding policies, etc. FIXME Moved from core project to api project because of bug in groovy's covariant return types. EntityDriver needs to return EntityLocal rather than Entity, to avoid changing a whole load of sub-types. FIXME Add setAttribute(AttributeSensorAndConfigKey) back in if/when move it back, or if we extract an interface for AttributeSensorAndConfigKey.


Method Summary
<T> void
emit(Sensor<T> sensor, T value)
          Emits a SensorEvent event on behalf of this entity (as though produced by this entity).
<T> T
getConfig(brooklyn.config.ConfigKey.HasConfigKey<T> key)
           
<T> T
getConfig(brooklyn.config.ConfigKey.HasConfigKey<T> key, T defaultValue)
          Deprecated. in 0.5; use #getConfig(HasConfigKey)
<T> T
getConfig(brooklyn.config.ConfigKey<T> key, T defaultValue)
          Deprecated. in 0.5; use Entity.getConfig(ConfigKey)
 ExecutionContext getExecutionContext()
          Deprecated. since 0.5.0; access via EntityInternal#getExecutionContext().
 ManagementContext getManagementContext()
          Deprecated. since 0.5.0; access via EntityInternal#getManagementContext().
 boolean removeAllEnrichers()
          Removes all enricher from this entity.
 boolean removeAllPolicies()
          Removes all policy from this entity.
<T> T
setAttribute(AttributeSensor<T> sensor, T val)
          Sets the Sensor data for the given attribute to the specified value.
<T> T
setConfig(brooklyn.config.ConfigKey.HasConfigKey<T> key, T val)
           
<T> T
setConfig(brooklyn.config.ConfigKey.HasConfigKey<T> key, Task<T> val)
           
<T> T
setConfig(brooklyn.config.ConfigKey<T> key, T val)
          Must be called before the entity is managed.
<T> T
setConfig(brooklyn.config.ConfigKey<T> key, Task<T> val)
           
 void setDisplayName(String displayName)
          Sets the entity's display name.
<T> SubscriptionHandle
subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener)
          Allow us to subscribe to data from a Sensor on another entity.
<T> SubscriptionHandle
subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener)
           
<T> SubscriptionHandle
subscribeToMembers(Group group, Sensor<T> sensor, SensorEventListener<? super T> listener)
           
 boolean unsubscribe(Entity producer)
          Unsubscribes from the given producer.
 boolean unsubscribe(Entity producer, SubscriptionHandle handle)
          Unsubscribes the given handle.
 
Methods inherited from interface brooklyn.entity.Entity
addChild, addChild, addEnricher, addGroup, addPolicy, clearParent, getApplication, getApplicationId, getAttribute, getChildren, getConfig, getCreationTime, getDisplayName, getEnrichers, getEntityType, getGroups, getIconUrl, getId, getLocations, getParent, getPolicies, getRebindSupport, invoke, removeChild, removeEnricher, removePolicy, setParent
 

Method Detail

setDisplayName

void setDisplayName(String displayName)
Sets the entity's display name. Must be called before the entity is managed.


setConfig

<T> T setConfig(brooklyn.config.ConfigKey<T> key,
                T val)
Must be called before the entity is managed.

Specified by:
setConfig in interface Configurable

setConfig

<T> T setConfig(brooklyn.config.ConfigKey<T> key,
                Task<T> val)

setConfig

<T> T setConfig(brooklyn.config.ConfigKey.HasConfigKey<T> key,
                T val)

setConfig

<T> T setConfig(brooklyn.config.ConfigKey.HasConfigKey<T> key,
                Task<T> val)

setAttribute

<T> T setAttribute(AttributeSensor<T> sensor,
                   T 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)

getConfig

<T> T getConfig(brooklyn.config.ConfigKey<T> key,
                T defaultValue)
Deprecated. in 0.5; use Entity.getConfig(ConfigKey)


getConfig

<T> T getConfig(brooklyn.config.ConfigKey.HasConfigKey<T> key)
Specified by:
getConfig in interface Entity

getConfig

<T> T getConfig(brooklyn.config.ConfigKey.HasConfigKey<T> key,
                T defaultValue)
Deprecated. in 0.5; use #getConfig(HasConfigKey)


emit

<T> void emit(Sensor<T> sensor,
              T 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.


subscribe

@Beta
<T> SubscriptionHandle subscribe(Entity producer,
                                      Sensor<T> sensor,
                                      SensorEventListener<? super T> 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)

subscribeToChildren

@Beta
<T> SubscriptionHandle subscribeToChildren(Entity parent,
                                                Sensor<T> sensor,
                                                SensorEventListener<? super T> listener)
See Also:
SubscriptionManager.subscribeToChildren(Map, Entity, Sensor, SensorEventListener)

subscribeToMembers

@Beta
<T> SubscriptionHandle subscribeToMembers(Group group,
                                               Sensor<T> sensor,
                                               SensorEventListener<? super T> listener)
See Also:
SubscriptionManager.subscribeToMembers(Group, Sensor, SensorEventListener)

unsubscribe

@Beta
boolean unsubscribe(Entity producer)
Unsubscribes from the given producer.

See Also:
SubscriptionContext.unsubscribe(SubscriptionHandle)

unsubscribe

@Beta
boolean unsubscribe(Entity producer,
                         SubscriptionHandle handle)
Unsubscribes the given handle.

See Also:
SubscriptionContext.unsubscribe(SubscriptionHandle)

removeAllPolicies

boolean removeAllPolicies()
Removes all policy from this entity.

Returns:
True if any policies existed at this entity; false otherwise

removeAllEnrichers

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

getManagementContext

ManagementContext getManagementContext()
Deprecated. since 0.5.0; access via EntityInternal#getManagementContext().

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

getExecutionContext

ExecutionContext getExecutionContext()
Deprecated. since 0.5.0; access via EntityInternal#getExecutionContext().

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


Copyright © 2013. All Rights Reserved.