Mike Hogan wrote:
Hi,
I am very confused about the right way to do IoC with Fortress.
org.apache.avalon.fortress.examples.swing.SwingContainer in the Fortress
examples seems to indicate that the way to get access to a component is to
explicitly call lookup() on the service manager. I don't see how this is
IoC, since I have full control of the public interface of the service
manager. Contrast this with the way XWork's component manager operates. It
pushes components to you. It seems more IoC to me. I know this can be done
with the service() method using "@avalon.dependency", but the components I
am writing are not providing service() - I'm writing a Swing app, not a
service.
So, the crux of my question is: what is the recommended way to acquire
components in Fortress applications, especially when not using service()?
IoC is when the container, or owner, provides all things that the
component needs to opperate.
The ServiceManager is still IoC because the Container has the ability
to only allow access to the components that that it says it needs. Both
Merlin and Phoenix do this already. It will be a feature of a future
Fortress release.
It seems that XWork is doing a more direct IoC where the components are
handed in like the ServiceManager.
Truthfully speaking, if you want Fortress to behave a little more like
XWork it is possible thorugh the use of lifecycle extensions. My GUIApp
framework at http://d-haven.org/guiapp uses the lifecycle extensions to
pass in the EventBus that all the GUI components use.
In the GUIApp framework, my Screens are components that provide a
JPanel that can be made into a dialog box or embedded in the main
screen. It works rather well. The advantage of that approach is
that the screens have access to the components that I don't have to
work around the system so to speak.
In a GUI application, screens are another type of component in the
system--even if you are going strictly by "Swing components". Why
shouldn't they be able to access components that manage business logic
or obtain the information that needs to be displayed?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]