|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deduced.dynamic.DefaultActionInvoker
public class DefaultActionInvoker
Default Action Invoker
Field Summary | |
---|---|
private static java.util.logging.Logger |
LOGGER
logger |
Constructor Summary | |
---|---|
DefaultActionInvoker()
|
Method Summary | |
---|---|
private java.lang.Object[] |
assembleParameters(PropertyCollection<?,?> collection,
PropertyCollection<?,?> action,
InvocationParameter[] parameters,
java.lang.String actionName)
assemble Parameters in an ordered array of values |
private void |
checkForUnusedParameters(PropertyCollection<?,?> collection,
InvocationParameter[] parameters,
java.lang.String actionName,
java.util.Map<java.lang.String,InvocationParameter> mappedParameters)
check For Unused Parameters and log them if necessary |
static java.lang.String |
createInvokeActionMessage(PropertyCollection<?,?> collection,
java.lang.String actionName,
InvocationParameter[] parameters)
create Invoke Action Message |
java.util.Map<java.lang.String,InvocationParameter> |
createNamedParameterMap(PropertyCollection<?,?> collection,
InvocationParameter[] parameters,
java.lang.String actionName)
create a Named Parameter Map |
java.lang.Object |
extractParameterValue(PropertyCollection<?,?> collection,
InvocationParameter[] parameters,
java.lang.String actionName,
PropertyCollection<?,?> parameterDefinition,
java.lang.String parameterName,
InvocationParameter currentAssignment)
extract Parameter Value |
static PropertyCollection<?,?> |
findActionByNameOnType(java.lang.String actionName,
PropertyCollection<?,?> type)
find Action By Name On Type |
static RuleExecutionContext |
getContextFromCollection(PropertyCollection<?,?> collection)
get Context From Collection |
java.lang.Object |
invokeAction(PropertyCollection<?,?> collection,
java.lang.String actionName,
InvocationParameter[] parameters)
(non-JSDoc) |
java.lang.Object |
invokeActionSilent(PropertyCollection<?,?> collection,
java.lang.String actionName,
InvocationParameter[] parameters)
(non-JSDoc) |
static void |
logActionException(java.lang.Throwable exception)
log Action Exception |
static java.lang.String |
printParameters(InvocationParameter[] parameters)
print Parameters |
private void |
validateAction(PropertyCollection<?,?> action,
PropertyCollection<?,?> collection,
java.lang.String actionName)
validate Action |
private void |
validateCollectionAndActionName(PropertyCollection<?,?> collection,
java.lang.String actionName)
validate Collection And Action name |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.util.logging.Logger LOGGER
Constructor Detail |
---|
public DefaultActionInvoker()
Method Detail |
---|
public java.lang.Object invokeAction(PropertyCollection<?,?> collection, java.lang.String actionName, InvocationParameter[] parameters) throws java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, java.lang.NullPointerException, java.lang.IllegalStateException, CompilationFailedException
invokeAction
in interface ActionInvoker
collection
- the property collectionactionName
- the action name to invokeparameters
- the list of parameter and value to invoke. Any
parameter not in this list will be assigned a default value.
If a parameter doesn't have a default value, an
InvocationTargetException will be thrown.
java.lang.IllegalArgumentException
- if some of the parameters are wrong or
missing or the action fails to compile.
java.lang.reflect.InvocationTargetException
- if the action code throws an exception.
java.lang.NullPointerException
- if the collection or actionName parameters
are null.
java.lang.IllegalStateException
- if action isn't enabled.
CompilationFailedException
- if action failed to compile.ActionInvoker.invokeAction(org.deduced.PropertyCollection,
java.lang.String, org.deduced.InvocationParameter[])
private java.lang.Object[] assembleParameters(PropertyCollection<?,?> collection, PropertyCollection<?,?> action, InvocationParameter[] parameters, java.lang.String actionName)
collection
- the collection on which to invoke the actionaction
- the actionparameters
- the parametersactionName
- the action name
private void checkForUnusedParameters(PropertyCollection<?,?> collection, InvocationParameter[] parameters, java.lang.String actionName, java.util.Map<java.lang.String,InvocationParameter> mappedParameters)
collection
- the collection on which to invoke the actionparameters
- the parametersactionName
- the action namemappedParameters
- the map of remaining parameterspublic java.lang.Object extractParameterValue(PropertyCollection<?,?> collection, InvocationParameter[] parameters, java.lang.String actionName, PropertyCollection<?,?> parameterDefinition, java.lang.String parameterName, InvocationParameter currentAssignment)
collection
- the collection on which to invoke the actionparameters
- the parameters to useactionName
- the action nameparameterDefinition
- the parameter definitionparameterName
- the parameter namecurrentAssignment
- the current parameter assignment
public static RuleExecutionContext getContextFromCollection(PropertyCollection<?,?> collection)
collection
- the collection from which to fetch the context
public java.util.Map<java.lang.String,InvocationParameter> createNamedParameterMap(PropertyCollection<?,?> collection, InvocationParameter[] parameters, java.lang.String actionName)
collection
- the collection on which to invoke the actionparameters
- the parameters to useactionName
- the action name
public static java.lang.String createInvokeActionMessage(PropertyCollection<?,?> collection, java.lang.String actionName, InvocationParameter[] parameters)
collection
- collection on which the action is invokedactionName
- action nameparameters
- parameter values
public static java.lang.String printParameters(InvocationParameter[] parameters)
parameters
- parameters to print
private void validateAction(PropertyCollection<?,?> action, PropertyCollection<?,?> collection, java.lang.String actionName)
action
- the action to validatecollection
- on which collectionactionName
- the matching action nameprivate void validateCollectionAndActionName(PropertyCollection<?,?> collection, java.lang.String actionName)
collection
- the collection to validateactionName
- the action name to validatepublic static PropertyCollection<?,?> findActionByNameOnType(java.lang.String actionName, PropertyCollection<?,?> type)
actionName
- the action name to findtype
- the type to search
public java.lang.Object invokeActionSilent(PropertyCollection<?,?> collection, java.lang.String actionName, InvocationParameter[] parameters)
invokeActionSilent
in interface ActionInvoker
collection
- the property collectionactionName
- the action name to invokeparameters
- the list of parameter and value to invoke. Any
parameter not in this list will be assigned a default value.
If a parameter doesn't have a default value, an
InvocationTargetException will be thrown.
ActionInvoker.invokeActionSilent(org.deduced.PropertyCollection,
java.lang.String, org.deduced.InvocationParameter[])
public static void logActionException(java.lang.Throwable exception)
exception
- the error that was detected
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |