Closed rju closed 2 days ago
author André van Hoorn -- Thu, 24 Nov 2011 14:34:03 +0100
I agree, that we should think about tweaking this concept in a later step --- e.g. adding, as alternatives, your proposed solution or the support of using Java annotations (as detailed below).
In general I think that our current implementation supports these extensions in later steps.
Replying to
KIEKER-1047
Done
:
> Better would be an automatic delegation of each incoming call on a port to a method like:
> void newEvent(IInputPort inPort, Object event)
> This method would be enforced by the AbstractAnalysisPlugin and a concrete default implementation of the AbstractInputPort could provide the delegation.
This would result in a switch/case block or if-then-else cascade in the newEvent method, right?
Could be implemented by special input ports (e.g.) created by a factory in the super class. These input ports transparently redirect the incoming event to the common handler function of the plugin.
> A remaining problem is, when to tell the OutputPort where to deliver its messages. You must not let this escape during the construction of the Plugin.
I don't see the problem here. The plugin (implementation) knows best when to deliver records to the right output port(s).
> Another approach might be the move of the construction of ports into the Abstract Super class (in registerInputPort). Thus this class is simply called several times with the names (or whatever) of the wanted ports and then correctly creates them.
Some time ago, we thought about using Java annotations for this purpose. These would be used to mark and configure input ports, e.g.:
InputPort(name="myInputPort", types={MonitoringRecord.class}) public void newEvent(Object event) { }
In a later step, we might support this as an alternative way of declaring input ports. What do you think?
author Jan Waller -- Thu, 24 Nov 2011 14:36:29 +0100
Replying to [avh|comment:1]:
> Some time ago, we thought about using Java annotations for this purpose. These would be used to mark and configure input ports, e.g.:
>
> {{
{ > InputPort(name="myInputPort", types={MonitoringRecord.class}
)
> public void newEvent(Object event) {
>
> }
> }}}
>
> In a later step, we might support this as an alternative way of declaring input ports. What do you think?
I really like that one. It could lead to lean and readable code.
author rju -- Thu, 24 Nov 2011 15:16:36 +0100
We already have a proposal to that. We could develop and evaluate the proposal in a separate branch. I considered doing that, after the 15. December.
author André van Hoorn -- Thu, 24 Nov 2011 15:20:51 +0100
Replying to [rju|comment:3]:
> We already have a proposal to that. We could develop and evaluate the proposal in a separate branch. I considered doing that, after the 15. December.
Yes, see my link to the Proposals/FilterArch Proposals/FilterArch above.
And as I wrote above: this could be implemented as an overlay for our current implementation.
author Jan Waller -- Thu, 24 Nov 2011 16:23:11 +0100
Replying to [rju|comment:3]:
> We already have a proposal to that. We could develop and evaluate the proposal in a separate branch. I considered doing that, after the 15. December.
Count me in
author nils-christian -- Thu, 24 Nov 2011 19:30:37 +0100
Replying to [jwa|comment:5]:
> Replying to [rju|comment:3]:
> > We already have a proposal to that. We could develop and evaluate the proposal in a separate branch. I considered doing that, after the 15. December.
>
> Count me in
Once the current pipe&filter-structure is fully tested and everything (and maybe even in the master), I think this one could indeed be a very good idea.
author André van Hoorn -- Mon, 30 Jan 2012 16:45:10 +0100
In the meantime, this ticket has become obsolete as we have this functionality, right?
Jan Waller: Please close this ticket, if you agree.
JIRA Issue: KIEKER-1047 Delegation of InputPort to AnalysisPlugin Original Reporter: Jan Waller
In the current implementation, each AnalysisPlugin has one or more InputPorts. These Ports are triggered on incoming data.
The result of this implementation method is: Each Plugin does nothing by itself, instead in contains one or more anonymous classes, doing all its work.
This is (in my opinion) bad style.
1. Anonymous classes are harder to read and understand.
2. They weaken private visibility (for each access the compiler generates a new access$XXXX() method, making a private member visible)
3. The Plugin should (conceptually) implement its own work.
Better would be an automatic delegation of each incoming call on a port to a method like:
void newEvent(IInputPort inPort, Object event)
This method would be enforced by the AbstractAnalysisPlugin and a concrete default implementation of the AbstractInputPort could provide the delegation.
A remaining problem is, when to tell the OutputPort where to deliver its messages. You must not let this escape during the construction of the Plugin.
Another approach might be the move of the construction of ports into the Abstract Super class (in registerInputPort). Thus this class is simply called several times with the names (or whatever) of the wanted ports and then correctly creates them.