Vjeran Marcinko wrote: >Hi folks. >I'm embarassed how much simple question I have to ask lately, but since there's no much of documentation, I don't see any other way... >Can you answer me shortly - Does every component that is capable of generating asynchronous events (let's say to all of it's registered listeners) is >violating IOC concept since then control flows from said component to any registered listener, and not only to it's child component? >Example is excalibur's resource monitor component that notifies listeners when resource gets changed ....
My answer would be no. I think we have to separate two concepts: flow of *control* and flow of *information*. Well, we could get philosophical about whether on a very fundamental basis control and information are indeed equivalent but that's not the point. Nearly every component passes information to its parent component, be it only in the form of a return value of a method called on this component. But the *interpretation* and *usage* of this information is entirely up to the parent component. So is the interpretation and usage of those change events passed to it by Excalibur's resource monitor component. On the other hand, if a parent component decides to equip a child component during contextualization/configuration with a certain fixed set of resources, be it other components, database connections etc, this child component has no choice but to operate within the confines determined by these resources. Thus *control* flows from parent to child, which is a good thing. A child would violate the IOC if it were to call, say, a hypothetical setDatabaseConnection(Connection conn) method on its parent component, thus altering its set of resources/configuration options. No decent, god-fearing child will ever do that to its mother! Well, that's my view. Hope it helps, Regards, Olaf Bergner -- To unsubscribe, e-mail: <mailto:avalon-users-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:avalon-users-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:avalon-users-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:avalon-users-help@;jakarta.apache.org>
