Workflow Listener

Hello,

My goal is to build a class to retrieve information of workflow whenever the workflow or any node inside execute. I noticed that WorkflowListener implementing objects will be notified if such changes to workflow occurs. I also found that Workflow Manager class has addListener method which add all WorkflowListener implementing objects. However, I cannot find where WorkflowManager or any class calls the addListener method.

Could you please clarify for me where and how I can add the new WorkflowListener implementing class, or any approach which results in the same purpose?

 

Thanks in advance,

focusnan

I am not sure why you would expect WorkflowManager to call addListener itself? The classes you define which implement the Listener interface should call this instead and that way register themselves for state change events? Maybe I am missing something, though?

Out of curiosity - what kind of application are you building around the WorkflowManager?

Michael

Hi Michael,

Thank you for your reply. I might ask it incorrectly. Actually, at first I would like to find if there is any class that use addListener method. Since addListener method should be called via WorkflowManager object(like workflowmanager.addListener(this)), I would like to know how the workflow manager object could be passed to the listener. If I understand it right, one workflow has its own workflow manager. 

However, I have found that there is ROOT object which is static, so I use that one for the new listener object to register itself. 

I still cannot figure out how I could link my new listener with the existing code. At first I think about plug-in but it seems like there is no extension point for this. Could you please recommend me any idea on this? By the way, I try to record provenance data, so I need to know when the states of nodes change.

Nan

Hi Nan,

it sounds as if you want to attach to workflows within a running KNIME instance and not create your own WorkflowManager. That's a bit "unusual", of course. The workflows in KNIME are indeed arranged in a tree underneath that ROOT workflow - every project is essentially a "metanode" (=one instance of WorkflowManager) with no in/outports. So in principle you could query the ROOT-workflow for the node with the ID of your project and then registered your listener there...

Michael

Hi Michael,

Would you recommend to build a new WorkflowManager instead?

Many Thanks,
Nan

Hi Michael,

I would like to ask if I extend WorkflowManager class how I could link it with the existing KNIME? Compared with building a new node, a new plug-in can extend at the extension point provided(knime.workbench.repository.node). I cannot find any extension point provided for my case. Therefore, I try to use addListener instead.

Nan

...well, we never imagined anyone wanting to add new WorkflowManagers. I guess you won't get around building your own KNIME with the added functionality - If you do derive from WorkflowManager you could add instances of your new class to existing WorkflowManagers, of course - in the end those are all nodes and can be added to projects or even the ROOT project...

Michael