Bart Molenkamp wrote:
-----Oorspronkelijk bericht-----
Van: Sylvain Wallez [mailto:[EMAIL PROTECTED]
Verzonden: maandag 17 oktober 2005 18:30
Aan: dev@cocoon.apache.org
Onderwerp: Startable components
Hi all,
I changed the lazy loading so that preload="true" is no more needed for
components that *must* be loaded at startup time.
Why are marker interfaces preferred over this configuration style? These
interfaces introduce another dependency on Avalon. I think it is better
to not have these code dependencies, but to use configuration. This
makes it easier to host those components in other containers as well,
such as Spring. Same for the ThreadSafe marker interface, the
Initializable and the Disposable interfaces (configure a method to do
initialization/disposing of the object instead of implementing an
interface).
And I thought that people here rather move away from Avalon's
interfaces. Then why introduce another dependency on it, when
configuration can do the same?
I understand and agree with your point, and the initial version of
preloading was implemented using configuration only. Now Cocoon has a
long history where the lifestyle of components is defined by interfaces,
allowing configuration writers not to care about it. So requiring them
not to forget this preload="true" would very likely cause problems
because people aren't used to it. Hence the idea of a marker interface.
Now some points are worth mentioning:
- the configuration attribute preload="true|false" is still available if
you don't want to use marker interfaces, or if you want to preload
components that don't implement these interfaces.
- this is for ECM-managed components only. Other containers have
different ways of specifying lifecycle.
- along with Avalon-defined Startable which requires two additional
methods, the Cocoon-defined Preloadable marker interface will also be
supported.
- as I stated in my previous post, the marker interface are added to
Cocoon components that *must* be loaded at startup time, thus ensuring
proper startup even if preload="true" is missing.
Hope this makes things clearer.
Sylvain
--
Sylvain Wallez Anyware Technologies
http://people.apache.org/~sylvain http://www.anyware-tech.com
Apache Software Foundation Member Research & Technology Director