|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.event.adapter.AbstractSensorAdapter
brooklyn.event.adapter.FunctionSensorAdapter
class FunctionSensorAdapter extends AbstractSensorAdapter
Entry point for wiring up arbitrary functions to be used as the source for sensors.
Example usage:
def fnSensorAdaptor = sensorRegistry.register(new FunctionSensorAdapter(&myFunction));
fnSensorAdaptor.poll(MY_BROOKLYN_RAW_DATA_ATTRIBUTE)
fnSensorAdaptor.then({ MyStruct.parse(it) }).with {
then({ it.field1 }).poll(MY_BROOKLYN_ATTRIBUTE_1)
then({ it.field2 }).poll(MY_BROOKLYN_ATTRIBUTE_2)
}
//or, field1 access can also be written:
fnSensorAdaptor.poll(MY_BROOKLYN_ATTRIBUTE_1, { MyStruct.parse(it).field1 } )
Field Summary | |
---|---|
static long |
CALL_TIMEOUT_MS
|
protected java.util.concurrent.Callable |
callable
|
protected FunctionBasePollHelper |
poller
|
Constructor Summary | |
FunctionSensorAdapter(java.util.Map flags = [:])
|
|
FunctionSensorAdapter(java.util.Map flags = [:], java.util.concurrent.Callable c)
|
Method Summary | |
---|---|
java.lang.Object
|
call()
|
void
|
poll(Sensor s, groovy.lang.Closure c = {it})
|
FunctionCallAdapter
|
then(groovy.lang.Closure f)
|
FunctionCallAdapter
|
then(Function f)
|
Methods inherited from class AbstractSensorAdapter | |
---|---|
activateAdapter, addActivationLifecycleListeners, deactivateAdapter, isConnected, register |
Field Detail |
---|
public static final long CALL_TIMEOUT_MS
protected final java.util.concurrent.Callable callable
protected final FunctionBasePollHelper poller
Constructor Detail |
---|
FunctionSensorAdapter(java.util.Map flags = [:])
FunctionSensorAdapter(java.util.Map flags = [:], java.util.concurrent.Callable c)
Method Detail |
---|
java.lang.Object call()
void poll(Sensor s, groovy.lang.Closure c = {it})
FunctionCallAdapter then(groovy.lang.Closure f)
FunctionCallAdapter then(Function f)
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.