I think an expression language might be a nice fit. I have to admit I'm a bit dissolusioned with Chain as it doesn't seem to model moderately complex processes well. In theory, each Command will be independent and dropped in at will, but in reality, it will require certain objects in the context and do different things if placed in a different order, but now its dependencies are hidden in its code making it difficult to determine behavior looking at its configuration.
I'd like to see what our current chain would look like using an expression language like JEXL.
well, most of our current chain isn't very conditional, but here's how one thing (which isn't "current" yet, but which I'm fooling around with) might work.
======= Using a custom subclass of LookupCommand ========== <!-- Deal with invalid form. --> <lookupIf catalogName="struts" name="process-invalid-form" contextKey="formValid" condition="false" optional="true"/>
<!-- Normal operation (when form is valid). --> <lookupIf catalogName="struts" name="process-action" contextKey="formValid" condition="true" ifNull="true" optional="true"/>
======= Using JEXL in a hypothetical "ConditionalExpressionCommand" ========== <!-- Deal with invalid form. --> <lookupIf catalogName="struts" name="process-invalid-form" condition="${ not empty context.formValid and not context.formValid }" optional="true"/>
<!-- Normal operation (when form is valid). --> <lookupIf catalogName="struts" name="process-action" condition="${ empty context.formValid or context.formValid }" optional="true"/>
The other general way that I see expressions being handy would be to do runtime lookups. Going back to my longtime itch around "page preparation," I've thought perhaps about having a lookup command which took its value from the context:
<lookup
catalogName="pagePrep"
name="${context.forwardConfig.path}"
optional="true" />
If instead we decided to support command/catalog properties on the ForwardConfig object, this would be less relevant, although it might allow you to avoid a bit of tedious configuration.
I don't think JEXL does regular expressions; anything much more interesting than the above would probably require that -- like having certain commands preprocess based on path prefixes... or (look out, vessels may pop) Script commands.
Joe
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]