S
- source sensor typeTKey
- key type in target sensor mapTVal
- value type in target sensor mappublic class UpdatingMap<S,TKey,TVal> extends AbstractEnricher implements SensorEventListener<S>
TARGET_SENSOR
)
based on the value of another sensor (SOURCE_SENSOR
.
The key used defaults to the name of the source sensor but can be specified with KEY_IN_TARGET_SENSOR
.
The value placed in the map is the result of applying the function in COMPUTING
to the sensor value,
with default behaviour being to remove an entry if null
is returned
but this can be overriden by setting REMOVING_IF_RESULT_IS_NULL
false.
Entities.REMOVE
and Entities.UNCHANGED
are also respeced as return values for the computation
(ignoring generics).
Unlike most other enrichers, this defaults to AbstractEnricher.SUPPRESS_DUPLICATES
being true
AbstractEntityAdjunct.AdjunctTagSupport, AbstractEntityAdjunct.BasicSubscriptionSupport
BrooklynObject.RelationSupport<T extends BrooklynObject>, BrooklynObject.SubscriptionSupport, BrooklynObject.TagSupport
Configurable.ConfigurationSupport
BrooklynObjectInternal.ConfigurationSupportInternal, BrooklynObjectInternal.RelationSupportInternal<T extends BrooklynObject>, BrooklynObjectInternal.SubscriptionSupportInternal
Modifier and Type | Field and Description |
---|---|
static ConfigKey<<any>> |
COMPUTING |
static ConfigKey<java.lang.Object> |
KEY_IN_TARGET_SENSOR |
static ConfigKey<Entity> |
PRODUCER |
static ConfigKey<java.lang.Boolean> |
REMOVING_IF_RESULT_IS_NULL |
static ConfigKey<Sensor<?>> |
SOURCE_SENSOR |
static ConfigKey<Sensor<?>> |
TARGET_SENSOR |
SUPPRESS_DUPLICATES
HIGHLIGHT_NAME_LAST_ACTION, HIGHLIGHT_NAME_LAST_CONFIRMATION, HIGHLIGHT_NAME_LAST_VIOLATION, HIGHLIGHT_NAME_TRIGGERS
NOOP
Constructor and Description |
---|
UpdatingMap() |
Modifier and Type | Method and Description |
---|---|
void |
init()
Called by framework (in new-style instances where spec was used) after configuring etc,
but before a reference to this instance is shared.
|
void |
onEvent(SensorEvent<S> event)
The
SensorEvent handler method. |
void |
setEntity(EntityLocal entity) |
getEnricherType, getRebindSupport, relations
config, configure, destroy, getAdjunctType, getConfig, getDisplayName, getEntity, getExecutionContext, getHighlights, getManagementContext, getUniqueTag, isDestroyed, isRunning, setDisplayName, setHighlights, subscriptions, tags, toString
addSearchPath, getCatalogItemId, getCatalogItemIdSearchPath, getId, rebind, setCatalogItemId, setCatalogItemIdAndSearchPath, setManagementContext, stackCatalogItemId
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getHighlights, getUniqueTag, isDestroyed, isRunning
getCatalogItemId, getCatalogItemIdSearchPath, getDisplayName, subscriptions, tags
config, getConfig
addSearchPath, setCatalogItemId, setCatalogItemIdAndSearchPath, stackCatalogItemId
public static final ConfigKey<java.lang.Object> KEY_IN_TARGET_SENSOR
public static final ConfigKey<<any>> COMPUTING
public static final ConfigKey<java.lang.Boolean> REMOVING_IF_RESULT_IS_NULL
public void init()
AbstractBrooklynObject
To preserve backwards compatibility for if the instance is constructed directly, one can call the code below, but that means it will be called after references to this policy have been shared with other entities.
if (isLegacyConstruction()) {
init();
}
init
in class AbstractBrooklynObject
public void setEntity(EntityLocal entity)
setEntity
in class AbstractEnricher
public void onEvent(SensorEvent<S> event)
SensorEventListener
SensorEvent
handler method.onEvent
in interface SensorEventListener<S>