Brooklyn

brooklyn.entity.basic
[Java] Interface EntityLocal

brooklyn.entity.Entity
  brooklyn.entity.trait.Configurable
      brooklyn.entity.basic.EntityLocal
          brooklyn.entity.rebind.Rebindable
All Superinterfaces:
Entity, Configurable, Rebindable

public interface EntityLocal
extends Configurable, Entity

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

sets the value of the given attribute sensor from the config key value herein, // * if the config key resolves to a non-null value as a sensor // * // * @deprecated since 0.5; use setAttribute(AttributeSensor, Object), such as // *

//     * T val = getConfig(KEY.getConfigKey());
//     * if (val !

java.lang.Object getConfig(HasConfigKey key)

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

@deprecated in 0.5; use getConfig(HasConfigKey)

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.

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

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

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

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

void setDisplayName(java.lang.String displayName)

Sets the entity's display name.

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)

SubscriptionHandle subscribeToMembers(Group group, Sensor sensor, SensorEventListener listener)

@see SubscriptionManager#subscribeToMembers(Group, Sensor, SensorEventListener)

boolean unsubscribe(Entity producer)

Unsubscribes from the given producer.

boolean unsubscribe(Entity producer, SubscriptionHandle handle)

Unsubscribes the given handle.

 
Methods inherited from interface Entity
addChild, addChild, addEnricher, addGroup, addOwnedChild, addPolicy, clearOwner, clearParent, getApplication, getApplicationId, getAttribute, getChildren, getConfig, getDisplayName, getEnrichers, getEntityType, getGroups, getId, getLocations, getOwnedChildren, getOwner, getParent, getPolicies, getRebindSupport, invoke, removeChild, removeEnricher, removeOwnedChild, removePolicy, setOwner, setParent
 
Methods inherited from interface Configurable
setConfig
 

Method Detail

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)
sets the value of the given attribute sensor from the config key value herein, // * if the config key resolves to a non-null value as a sensor // * // *
deprecated:
since 0.5; use setAttribute(AttributeSensor, Object), such as // *
//     * T val = getConfig(KEY.getConfigKey());
//     * if (val != null) {
//     *     setAttribute(KEY, val)
//     * }
//     * 
// * // *
Returns:
old value //


getConfig

public java.lang.Object getConfig(HasConfigKey key)


getConfig

public java.lang.Object getConfig(HasConfigKey key, java.lang.Object defaultValue)
deprecated:
in 0.5; use getConfig(HasConfigKey)


getExecutionContext

public ExecutionContext getExecutionContext()
deprecated:
since 0.5.0; access via EntityInternal#getExecutionContext()#getExecutionContext().
Returns:
The task execution context for the entity, or null if it is not yet managed.


getManagementContext

public ManagementContext getManagementContext()
deprecated:
since 0.5.0; access via EntityInternal#getManagementContext()#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


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


setConfig

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


setConfig

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


setConfig

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


setDisplayName

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


subscribe

@Beta
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

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


subscribeToMembers

@Beta
public SubscriptionHandle subscribeToMembers(Group group, Sensor sensor, SensorEventListener listener)
See Also:
SubscriptionManager#subscribeToMembers(Group, Sensor, SensorEventListener)#subscribeToMembers(Group, Sensor, SensorEventListener)


unsubscribe

@Beta
public boolean unsubscribe(Entity producer)
Unsubscribes from the given producer.
See Also:
SubscriptionContext#unsubscribe(SubscriptionHandle)#unsubscribe(SubscriptionHandle)


unsubscribe

@Beta
public boolean unsubscribe(Entity producer, SubscriptionHandle handle)
Unsubscribes the given handle.
See Also:
SubscriptionContext#unsubscribe(SubscriptionHandle)#unsubscribe(SubscriptionHandle)


 

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