Brooklyn

brooklyn.management.internal
[Java] Class EffectorUtils

java.lang.Object
  brooklyn.management.internal.EffectorUtils

public class EffectorUtils

Utility methods for invoking effectors.


Method Summary
static Effector findEffectorMatching(Entity entity, java.lang.reflect.Method method)

returns a (mutable) map of the standard flags which should be placed on an effector

static Effector findEffectorMatching(java.util.Set effectors, java.lang.String effectorName, java.util.Map parameters)

static java.util.Map getTaskFlagsForEffectorInvocation(Entity entity, Effector effector)

static void handleEffectorException(Entity entity, Effector effector, java.lang.Throwable throwable)

static java.lang.Object invokeEffector(Entity entity, Effector eff, java.lang.Object[] args)

Invokes the effector so that its progress is tracked.

static java.lang.Object invokeEffector(AbstractEntity entity, java.lang.reflect.Method method, java.lang.Object[] args)

static Task invokeEffectorAsync(Entity entity, Effector eff, java.util.Map parameters)

static java.lang.Object invokeMethodEffector(Entity entity, Effector eff, java.lang.Object[] args)

Invokes a method effector so that its progress is tracked.

static java.lang.Object[] oldPrepareArgsForEffector(Effector eff, java.lang.Object args)

Takes arguments, and returns an array of arguments suitable for use by the Effector according to the ParameterTypes it exposes.

static java.lang.Object[] prepareArgsForEffector(Effector eff, java.lang.Object args)

prepares arguments for an effector either accepting: an array, which should contain the arguments in order, optionally omitting those which have defaults defined; or a map, which should contain the arguments by name, again optionally omitting those which have defaults defined, and in this case also performing type coercion.

static java.util.Map prepareArgsForEffectorAsMapFromArray(Effector eff, java.lang.Object[] args)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

findEffectorMatching

public static Effector findEffectorMatching(Entity entity, java.lang.reflect.Method method)
returns a (mutable) map of the standard flags which should be placed on an effector


findEffectorMatching

public static Effector findEffectorMatching(java.util.Set effectors, java.lang.String effectorName, java.util.Map parameters)


getTaskFlagsForEffectorInvocation

public static java.util.Map getTaskFlagsForEffectorInvocation(Entity entity, Effector effector)


handleEffectorException

public static void handleEffectorException(Entity entity, Effector effector, java.lang.Throwable throwable)


invokeEffector

public static java.lang.Object invokeEffector(Entity entity, Effector eff, java.lang.Object[] args)
Invokes the effector so that its progress is tracked.
deprecated:
since 0.6.0 this method name is misleading; it only works for MethodEffectors tightly tied to a method; most callers should use Entities#invokeEffector(brooklyn.entity.basic.EntityLocal, Entity, Effector, Map) to invoke or Effectors#invocation(Entity, Effector, Map)#invocation(Entity, Effector, Map) to just create (an uninvoked) task; or for low level usage possibly ManagementContextInternal#invokeEffector(Entity, Effector, Map)#invokeEffector(Entity, Effector, Map)


invokeEffector

public static java.lang.Object invokeEffector(AbstractEntity entity, java.lang.reflect.Method method, java.lang.Object[] args)


invokeEffectorAsync

public static Task invokeEffectorAsync(Entity entity, Effector eff, java.util.Map parameters)


invokeMethodEffector

public static java.lang.Object invokeMethodEffector(Entity entity, Effector eff, java.lang.Object[] args)
Invokes a method effector so that its progress is tracked. For internal use only, when we know the effector is backed by a method which is local.


oldPrepareArgsForEffector

public static java.lang.Object[] oldPrepareArgsForEffector(Effector eff, java.lang.Object args)
Takes arguments, and returns an array of arguments suitable for use by the Effector according to the ParameterTypes it exposes. The args can be: 1. an array of ordered arguments 2. a collection (which will be automatically converted to an array) 3. a single argument (which will then be wrapped in an array) 4. a map containing the (named) arguments 5. an array or collection single entry of a map (treated same as 5 above) 6. a semi-populated array or collection that also containing a map as first arg - uses ordered args in array, but uses named values from map in preference. 7. semi-populated array or collection, where default values will otherwise be used.


prepareArgsForEffector

public static java.lang.Object[] prepareArgsForEffector(Effector eff, java.lang.Object args)
prepares arguments for an effector either accepting: an array, which should contain the arguments in order, optionally omitting those which have defaults defined; or a map, which should contain the arguments by name, again optionally omitting those which have defaults defined, and in this case also performing type coercion.


prepareArgsForEffectorAsMapFromArray

public static java.util.Map prepareArgsForEffectorAsMapFromArray(Effector eff, java.lang.Object[] args)


 

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