public class InvokeEffectorOnCollectionSensorChange extends AbstractInvokeEffectorPolicy implements SensorEventListener<java.util.Collection<?>>
AttributeSensor and invokes the named
effectors for each element that was added and removed.
The policy only detects replacements of the collection; it does not act on
modifications. If the sensor has value A and an element is added –
value A' – the on-added effector is not invoked. If the sensor is
later set to B the delta is made between A and B,
not A' and B.
To simplify the detection of additions and removals the collection is converted to a
Set. This means that only a single event will fire for duplicate elements in
the collection. Null values for the sensor are considered an empty collection.
The effectors are provided the elements that changed in their parameter map. If the
sensor is a collection of maps the elements are provided with their keys coerced to
strings and their values unchanged. Otherwise the elements are provided in a
single-entry map keyed by the value for PARAMETER_NAME.
Effectors are asynchronous. If elements are added and removed in quick succession there are no guarantees that the `onAdded' task will have finished before the corresponding `onRemoved' task is invoked.
AbstractEntityAdjunct.AdjunctTagSupport, AbstractEntityAdjunct.BasicSubscriptionSupportBrooklynObject.RelationSupport<T extends BrooklynObject>, BrooklynObject.SubscriptionSupport, BrooklynObject.TagSupportConfigurable.ConfigurationSupportBrooklynObjectInternal.ConfigurationSupportInternal, BrooklynObjectInternal.RelationSupportInternal<T extends BrooklynObject>, BrooklynObjectInternal.SubscriptionSupportInternal| Modifier and Type | Field and Description |
|---|---|
static ConfigKey<java.lang.String> |
ON_ADDED_EFFECTOR_NAME |
static ConfigKey<java.lang.String> |
ON_REMOVED_EFFECTOR_NAME |
static ConfigKey<java.lang.String> |
PARAMETER_NAME |
static ConfigKey<AttributeSensor<? extends java.util.Collection<?>>> |
TRIGGER_SENSOR |
IS_BUSY_SENSOR_NAMEHIGHLIGHT_NAME_LAST_ACTION, HIGHLIGHT_NAME_LAST_CONFIRMATION, HIGHLIGHT_NAME_LAST_VIOLATION, HIGHLIGHT_NAME_TRIGGERSNOOP| Constructor and Description |
|---|
InvokeEffectorOnCollectionSensorChange() |
| Modifier and Type | Method and Description |
|---|---|
void |
onEvent(SensorEvent<java.util.Collection<?>> event)
The
SensorEvent handler method. |
void |
setEntity(EntityLocal entity) |
destroy, getPolicyType, getRebindSupport, isRunning, isSuspended, relations, resume, suspend, toStringconfig, configure, getAdjunctType, getConfig, getDisplayName, getEntity, getExecutionContext, getHighlights, getManagementContext, getUniqueTag, isDestroyed, setDisplayName, setHighlights, subscriptions, tagsaddSearchPath, getCatalogItemId, getCatalogItemIdSearchPath, getId, init, rebind, setCatalogItemId, setCatalogItemIdAndSearchPath, setManagementContext, stackCatalogItemIdequals, getClass, hashCode, notify, notifyAll, wait, wait, waitgetHighlights, getUniqueTag, isDestroyedgetCatalogItemId, getCatalogItemIdSearchPath, getDisplayName, subscriptions, tagsconfig, getConfigaddSearchPath, setCatalogItemId, setCatalogItemIdAndSearchPath, stackCatalogItemIdpublic static final ConfigKey<AttributeSensor<? extends java.util.Collection<?>>> TRIGGER_SENSOR
public static final ConfigKey<java.lang.String> ON_ADDED_EFFECTOR_NAME
public static final ConfigKey<java.lang.String> ON_REMOVED_EFFECTOR_NAME
public static final ConfigKey<java.lang.String> PARAMETER_NAME
public InvokeEffectorOnCollectionSensorChange()
public void setEntity(EntityLocal entity)
setEntity in class AbstractInvokeEffectorPolicypublic void onEvent(SensorEvent<java.util.Collection<?>> event)
SensorEventListenerSensorEvent handler method.onEvent in interface SensorEventListener<java.util.Collection<?>>