Brooklyn

brooklyn.enricher
[Java] Class CustomAggregatingEnricher

java.lang.Object
  brooklyn.policy.basic.AbstractEntityAdjunct
      brooklyn.enricher.basic.AbstractEnricher
          brooklyn.enricher.basic.AbstractAggregatingEnricher
              brooklyn.enricher.CustomAggregatingEnricher
All Implemented Interfaces:
SensorEventListener

public class CustomAggregatingEnricher
extends AbstractAggregatingEnricher

Subscribes to events from producers with a sensor of type T, aggregates them with the provided closure and emits the result on the target sensor V.

Parameters:


Field Summary
protected Function aggregator

 
Fields inherited from class AbstractAggregatingEnricher
defaultValue, target, values
 
Fields inherited from class AbstractEnricher
leftoverProperties
 
Fields inherited from class AbstractEntityAdjunct
_subscriptionTracker, entity, id, name
 
Constructor Summary
CustomAggregatingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, Function aggregator, S defaultValue)

The valid keys for the flags are: - producers: a collection of entities to be aggregated - allMembers: indicates that should track members of the entity that the aggregator is associated with, to aggregate across all those members

CustomAggregatingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, Function aggregator)

CustomAggregatingEnricher(AttributeSensor source, AttributeSensor target, Function aggregator, S defaultValue)

CustomAggregatingEnricher(AttributeSensor source, AttributeSensor target, Function aggregator)

CustomAggregatingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator, S defaultValue)

@param flags

CustomAggregatingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator)

CustomAggregatingEnricher(AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator, S defaultValue)

CustomAggregatingEnricher(AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator)

CustomAggregatingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator, S defaultValue)

deprecated:
will be deleted in 0.5.

CustomAggregatingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator)

CustomAggregatingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target, Function aggregator, S defaultValue)

deprecated:
will be deleted in 0.5.

CustomAggregatingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target, Function aggregator)

 
Method Summary
java.lang.Object getAggregate()

static CustomAggregatingEnricher getAveragingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target)

deprecated:
will be deleted in 0.5.

static CustomAggregatingEnricher getSummingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target)

deprecated:
will be deleted in 0.5.

static CustomAggregatingEnricher newAveragingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target)

creates an enricher which averages over all sensors, counting ZERO for sensors which have not yet published anything; to have those sensors excluded, pass null as an additional argument (defaultValue)

static CustomAggregatingEnricher newAveragingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, N defaultValue)

defaultValue of null means that the sensor is excluded

static CustomAggregatingEnricher newAveragingEnricher(AttributeSensor source, AttributeSensor target)

static CustomAggregatingEnricher newEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator, S defaultVal)

static CustomAggregatingEnricher newEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator)

static CustomAggregatingEnricher newEnricher(AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator, S defaultVal)

static CustomAggregatingEnricher newEnricher(AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator)

static CustomAggregatingEnricher newEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, Function aggregator, S defaultVal)

static CustomAggregatingEnricher newEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, Function aggregator)

static CustomAggregatingEnricher newEnricher(AttributeSensor source, AttributeSensor target, Function aggregator, S defaultVal)

static CustomAggregatingEnricher newEnricher(AttributeSensor source, AttributeSensor target, Function aggregator)

static CustomAggregatingEnricher newSummingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target)

static CustomAggregatingEnricher newSummingEnricher(AttributeSensor source, AttributeSensor target)

void onUpdated()

 
Methods inherited from class AbstractAggregatingEnricher
addProducer, copyOfValues, onEvent, onUpdated, removeProducer, setEntity
 
Methods inherited from class AbstractEnricher
configure
 
Methods inherited from class AbstractEntityAdjunct
check, destroy, getAllSubscriptions, getId, getManagementContext, getName, getSubscriptionTracker, isDestroyed, isRunning, setEntity, setId, setName, subscribe, subscribeToChildren, subscribeToMembers, unsubscribe, unsubscribe
 

Field Detail

aggregator

protected final Function aggregator


 
Constructor Detail

CustomAggregatingEnricher

public CustomAggregatingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, Function aggregator, S defaultValue)
The valid keys for the flags are: - producers: a collection of entities to be aggregated - allMembers: indicates that should track members of the entity that the aggregator is associated with, to aggregate across all those members. - filter: a Predicate or Closure, indicating which entities to include
Parameters:
flags
source
target
aggregator - Aggregates a collection of values, to return a single value for the target sensor
defaultValue - Default value to populate the collection given to aggregator, defaults to null


CustomAggregatingEnricher

public CustomAggregatingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, Function aggregator)


CustomAggregatingEnricher

public CustomAggregatingEnricher(AttributeSensor source, AttributeSensor target, Function aggregator, S defaultValue)


CustomAggregatingEnricher

public CustomAggregatingEnricher(AttributeSensor source, AttributeSensor target, Function aggregator)


CustomAggregatingEnricher

@SuppressWarnings("unchecked")
public CustomAggregatingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator, S defaultValue)
Parameters:
flags
source
target
aggregator - Should take a collection of values and return a single, aggregate value
defaultValue
See Also:
CustomAggregatingEnricher(Map, AttributeSensor, AttributeSensor target, Function, T> aggregator, S defaultValue)


CustomAggregatingEnricher

public CustomAggregatingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator)


CustomAggregatingEnricher

public CustomAggregatingEnricher(AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator, S defaultValue)


CustomAggregatingEnricher

public CustomAggregatingEnricher(AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator)


CustomAggregatingEnricher

@SuppressWarnings("unchecked")
public CustomAggregatingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator, S defaultValue)
deprecated:
will be deleted in 0.5. Use CustomAggregatingEnricher(source, target, aggregator, deafultValue, producers:producer)


CustomAggregatingEnricher

@Deprecated
public CustomAggregatingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator)


CustomAggregatingEnricher

@Deprecated
public CustomAggregatingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target, Function aggregator, S defaultValue)
deprecated:
will be deleted in 0.5. Use CustomAggregatingEnricher(source, target, aggregator, deafultValue, producers:producer)


CustomAggregatingEnricher

@Deprecated
public CustomAggregatingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target, Function aggregator)


 
Method Detail

getAggregate

public java.lang.Object getAggregate()


getAveragingEnricher

@Deprecated
public static CustomAggregatingEnricher getAveragingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target)
deprecated:
will be deleted in 0.5. Use newAveragingEnricher(source, target, producers:producer, allMembers:true)


getSummingEnricher

@Deprecated
public static CustomAggregatingEnricher getSummingEnricher(java.util.List producer, AttributeSensor source, AttributeSensor target)
deprecated:
will be deleted in 0.5. Use newAveragingEnricher(source, target, producers:producer, allMembers:true)


newAveragingEnricher

public static CustomAggregatingEnricher newAveragingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target)
creates an enricher which averages over all sensors, counting ZERO for sensors which have not yet published anything; to have those sensors excluded, pass null as an additional argument (defaultValue)


newAveragingEnricher

public static CustomAggregatingEnricher newAveragingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, N defaultValue)
defaultValue of null means that the sensor is excluded


newAveragingEnricher

public static CustomAggregatingEnricher newAveragingEnricher(AttributeSensor source, AttributeSensor target)


newEnricher

public static CustomAggregatingEnricher newEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator, S defaultVal)


newEnricher

public static CustomAggregatingEnricher newEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator)


newEnricher

public static CustomAggregatingEnricher newEnricher(AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator, S defaultVal)


newEnricher

public static CustomAggregatingEnricher newEnricher(AttributeSensor source, AttributeSensor target, groovy.lang.Closure aggregator)


newEnricher

public static CustomAggregatingEnricher newEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, Function aggregator, S defaultVal)


newEnricher

public static CustomAggregatingEnricher newEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, Function aggregator)


newEnricher

public static CustomAggregatingEnricher newEnricher(AttributeSensor source, AttributeSensor target, Function aggregator, S defaultVal)


newEnricher

public static CustomAggregatingEnricher newEnricher(AttributeSensor source, AttributeSensor target, Function aggregator)


newSummingEnricher

public static CustomAggregatingEnricher newSummingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target)


newSummingEnricher

public static CustomAggregatingEnricher newSummingEnricher(AttributeSensor source, AttributeSensor target)


onUpdated

@Override
public void onUpdated()


 

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