// Perform any common invoke functionality
super.invoke(env, context);
// Prepare data needed by the action
Map objectModel = env.getObjectModel();
Redirector redirector = PipelinesNode.getRedirector(env);
SourceResolver resolver = getSourceResolver(objectModel);
String resolvedSource = source.resolve(context, objectModel);
Parameters resolvedParams = VariableResolver.buildParameters(this.parameters, context, objectModel);
Map actionResult;
// If in action set, merge parameters
if (inActionSet) {
Parameters callerParams = (Parameters)env.getAttribute(ActionSetNode.CALLER_PARAMETERS);
if (resolvedParams == Parameters.EMPTY_PARAMETERS) {
// Just swap
resolvedParams = callerParams;
} else if (callerParams != Parameters.EMPTY_PARAMETERS) {
// Build a new Parameters object since the both we hare are read-only
Parameters newParams = new Parameters();
// And merge both
newParams.merge(resolvedParams);
newParams.merge(callerParams);
resolvedParams = newParams;
}
}
// If action is ThreadSafe, avoid select() and try/catch block (faster !)
if (this.threadSafeAction != null) {
actionResult = this.threadSafeAction.act(
redirector, resolver, objectModel, resolvedSource, resolvedParams);
} else {
Action action = (Action)this.selector.select(this.componentName);
try {
actionResult = action.act(
redirector, resolver, objectModel, resolvedSource, resolvedParams);
} finally {
this.selector.release(action);
}
}
if (redirector.hasRedirected()) {
return true;
}
if (actionResult == null) {
// Action failed