Hi Mihail,
Sarasvati is at the point now where I don't wish make the core any more complex that it already is, if the purpose can be built on top of existing functionality. This won't work for everything, but lets look at it from this perspective first.
Here is my analysis of what you need:
I. An interface for node listeners.
-------------------------------------------------------------------------------------------------------------------------------------------
ExecutionListener can be reused here. It will only receive node specific events.
II. A way to link listeners to nodes.
-------------------------------------------------------------------------------------------------------------------------------------------
i. Defining listeners
You could use <custom>, however that might be problematic. It's generally assumed that the contents of custom will all be loaded together. I think it might be interesting to allow optional modules to Sarasvati. The definition file then allow any number of <module id="moduleId"><!- xs:any --></module> sections.
ii. Storing links
There are a couple of options here.
1. You could store the listeners in wf_node_properties
2. You could create a sub-type of HibNode, which is tied to a custom table, allowing you store the listener definitions in a more structured format.
III. A way to invoke the interceptors -------------------------------------------------------------------------------------------------------------------------------------------
A global process listener would handle this. It could use the getAdapter method to get an ExecutionQueue from the Node.
As I see it, the main thing that Sarasvati is missing is a way to add custom elements to nodes that are handled by some plugin logic, rather than pushed through the default custom node logic. There may be a way to extend the NodeFactory interface to do this, or perhaps a Module interface would be best. Something like:
interface SarasvatiExtension
{
void install (Engine engine);
void load (Node node, Object moduleInfo);
}
and add a method to Engine: addExtenstion( SarasvatiExtension ext );
This would let it register the global process listener as well.
The reason I'm trying to figure out how to do this without touching the core is that I can see many potential enhancements, some of the incompatible. If we can handle them with an extension mechanism, the core stays maintainable while we can still optionally provide the features people want.
Thoughts?
Paul