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 AbstractEntityAdjunct
_subscriptionTracker, adjunctType, configsInternal, entity, execution, id, leftoverProperties, name
 
Constructor Summary
CustomAggregatingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, Function aggregator, S defaultIniitalValueForUnreportedSensors)

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

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

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

 
Method Summary
java.lang.Object getAggregate()

static CustomAggregatingEnricher newAveragingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, N defaultValueForUnreportedSensors, java.lang.Double valueToReportIfNoSensors)

creates an enricher which averages over all children/members, defaulting to excluding sensors which have not published anything (or published null), and null if there are no sensors; this behaviour can be customised, both default value for sensors, and what to report if no sensors

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

@see #newAveragingEnricher(Map, AttributeSensor, AttributeSensor, Number, Double)

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

@see #newAveragingEnricher(Map, AttributeSensor, AttributeSensor, Number, Double)

static CustomAggregatingEnricher newAveragingEnricher(AttributeSensor source, AttributeSensor target)

@see #newAveragingEnricher(Map, AttributeSensor, AttributeSensor, Number, Double)

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, N defaultValueForUnreportedSensors, java.lang.Object valueToReportIfNoSensors)

creates an enricher which sums over all children/members, defaulting to excluding sensors which have not published anything (or published null), and null if there are no sensors; this behaviour can be customised, both default value for sensors, and what to report if no sensors

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

@see newSummingEnricher(Map, AttributeSensor, AttributeSensor, Number, Number)

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

@see newSummingEnricher(Map, AttributeSensor, AttributeSensor, Number, Number)

static CustomAggregatingEnricher newSummingEnricher(AttributeSensor source, AttributeSensor target)

@see newSummingEnricher(Map, AttributeSensor, AttributeSensor, Number, Number)

static CustomAggregatingEnricher newSummingEnricher(AttributeSensor source, AttributeSensor target, N defaultValue)

@see newSummingEnricher(Map, AttributeSensor, AttributeSensor, Number, Number)

void onUpdated()

 
Methods inherited from class AbstractAggregatingEnricher
addProducer, copyOfValues, onEvent, onUpdated, removeProducer, setEntity
 
Methods inherited from class AbstractEnricher
getEnricherType
 
Methods inherited from class AbstractEntityAdjunct
check, configure, configure, destroy, doReconfigureConfig, getAdjunctType, getAllConfig, getAllSubscriptions, getConfig, getConfigMap, getId, getManagementContext, getName, getSubscriptionTracker, init, isDestroyed, isLegacyConstruction, isRunning, setConfig, setEntity, setId, setManagementContext, setName, subscribe, subscribeToChildren, subscribeToMembers, toString, 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 defaultIniitalValueForUnreportedSensors)
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
defaultIniitalValueForUnreportedSensors - Default value to populate the collection given to aggregator, where sensors are null or not present initially, defaults to null (note however that subsequent null reports will put an explicit 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 defaultValueForUnreportedSensors)
Parameters:
flags
source
target
aggregator - Should take a collection of values and return a single, aggregate value
defaultValueForUnreportedSensors
See Also:
CustomAggregatingEnricher(Map, AttributeSensor, AttributeSensor, Function, Object)


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


CustomAggregatingEnricher

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


 
Method Detail

getAggregate

public java.lang.Object getAggregate()


newAveragingEnricher

public static CustomAggregatingEnricher newAveragingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, N defaultValueForUnreportedSensors, java.lang.Double valueToReportIfNoSensors)
creates an enricher which averages over all children/members, defaulting to excluding sensors which have not published anything (or published null), and null if there are no sensors; this behaviour can be customised, both default value for sensors, and what to report if no sensors


newAveragingEnricher

or target) {
public static CustomAggregatingEnricher newAveragingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target)
deprecated:
since 0.6.0 to prevent sprawl, use one of the fuller methods
See Also:
newAveragingEnricher(Map, AttributeSensor, AttributeSensor, Number, Double)


newAveragingEnricher

or target,
public static CustomAggregatingEnricher newAveragingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, java.lang.Number defaultValue)
deprecated:
since 0.6.0 to prevent sprawl, use one of the fuller methods
See Also:
newAveragingEnricher(Map, AttributeSensor, AttributeSensor, Number, Double)


newAveragingEnricher

public static CustomAggregatingEnricher newAveragingEnricher(AttributeSensor source, AttributeSensor target)
See Also:
newAveragingEnricher(Map, AttributeSensor, AttributeSensor, Number, Double)


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, N defaultValueForUnreportedSensors, java.lang.Object valueToReportIfNoSensors)
creates an enricher which sums over all children/members, defaulting to excluding sensors which have not published anything (or published null), and null if there are no sensors; this behaviour can be customised, both default value for sensors, and what to report if no sensors


newSummingEnricher

> target) {
public static CustomAggregatingEnricher newSummingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target)
deprecated:
since 0.6.0 to prevent sprawl, use one of the fuller methods
See Also:


newSummingEnricher

> target, N defaultValue) {
public static CustomAggregatingEnricher newSummingEnricher(java.util.Map flags, AttributeSensor source, AttributeSensor target, N defaultValue)
deprecated:
since 0.6.0 to prevent sprawl, use one of the fuller methods
See Also:


newSummingEnricher

public static CustomAggregatingEnricher newSummingEnricher(AttributeSensor source, AttributeSensor target)
See Also:


newSummingEnricher

public static CustomAggregatingEnricher newSummingEnricher(AttributeSensor source, AttributeSensor target, N defaultValue)
deprecated:
since 0.6.0 to prevent sprawl, use one of the fuller methods
See Also:


onUpdated

@Override
public void onUpdated()


 

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