[OT] Re: An experiment with Spring... What about OSGi ?
Hi Brett, all, Have you considered using OSGi instead of [Plexus|Spring] ? I'm not an expert of one or the other, but i try to do some projects with OSGi since a few months and i like it. Best regards, Brett Porter a écrit : Hi, Given the discussion yesterday, I played around with some changes on a branch when I got up early this morning to show how we could do a partial migration to Spring without having to do it all at once. https://svn.apache.org/repos/asf/maven/archiva/branches/springy This shows: - ability to lookup plexus components via spring IoC - ability to lookup spring beans during the Plexus component lifecycle - basic functional setup for Spring in the Archiva application Eventually, as whole subsystems no longer require plexus it will be possible to clean it up, such as: - get rid of the additional lookups - use annotations for configuration - use testng + get/set + mocks for the tests where possible (and spring testcontext where integration testing is needed) Here is how to obtain a plexus object from Spring (note there is some pre-req setup in test cases you'll see in the commit, as there is in the additional servlet listener): bean id=urlCache factory-bean=plexusCacheFactory factory-method=createInstance / bean id=plexusCacheFactory class=org.apache.maven.archiva.common.spring.PlexusFactory constructor-arg index=0 value=org.codehaus.plexus.cache.Cache/ constructor-arg index=1 value=url-failures-cache/ /bean To get a spring bean inside a plexus component, it is like this (make sure to implement Initializable): /** * @plexus.requirement */ private SpringFactory springFactory; public void initialize() throws InitializationException { urlFailureCache = (UrlFailureCache) springFactory.lookup( urlFailureCache ); } The next thing we should probably try is using something like SpringCache as suggested to remove the plexus-cache dependency. Have fun! Cheers, Brett -- Brett Porter [EMAIL PROTECTED] http://blogs.exist.com/bporter/ -- Cordialement, Ludo - http://www.ubik-products.com --- L'amour pour principe et l'ordre pour base; le progres pour but (A.Comte)
Re: [OT] Re: An experiment with Spring... What about OSGi ?
Hi Carlos, Thanks for your answer, Carlos Sanchez a écrit : spring has good integration with OSGi to enable Spring beans to be OSGi services. Yes, i'm aware that this integration exist and i've read a couple of meetings reports related to it on the Equinox wiki, but why bother with the complicated Spring xml descriptors (well for me i admit that i haven't tried Spring since v1.2 iirc), is there any need in Archiva which is not adressed by OSGi (Felix/Sling for instance) + Modello ? I'm wondering what are the benefits of Spring (even with OSGi integration) regarding the current Plexus architecture or an alternative architecture based on some OSGi layer, which features does bring Spring which are not implemented in the other frameworks (including modello) ? Best regards, thanks for your time, On Mon, Feb 25, 2008 at 11:05 AM, Ludovic Maitre [EMAIL PROTECTED] wrote: Hi Brett, all, Have you considered using OSGi instead of [Plexus|Spring] ? I'm not an expert of one or the other, but i try to do some projects with OSGi since a few months and i like it. Best regards, Brett Porter a écrit : Hi, Given the discussion yesterday, I played around with some changes on a branch when I got up early this morning to show how we could do a partial migration to Spring without having to do it all at once. https://svn.apache.org/repos/asf/maven/archiva/branches/springy This shows: - ability to lookup plexus components via spring IoC - ability to lookup spring beans during the Plexus component lifecycle - basic functional setup for Spring in the Archiva application Eventually, as whole subsystems no longer require plexus it will be possible to clean it up, such as: - get rid of the additional lookups - use annotations for configuration - use testng + get/set + mocks for the tests where possible (and spring testcontext where integration testing is needed) Here is how to obtain a plexus object from Spring (note there is some pre-req setup in test cases you'll see in the commit, as there is in the additional servlet listener): bean id=urlCache factory-bean=plexusCacheFactory factory-method=createInstance / bean id=plexusCacheFactory class=org.apache.maven.archiva.common.spring.PlexusFactory constructor-arg index=0 value=org.codehaus.plexus.cache.Cache/ constructor-arg index=1 value=url-failures-cache/ /bean To get a spring bean inside a plexus component, it is like this (make sure to implement Initializable): /** * @plexus.requirement */ private SpringFactory springFactory; public void initialize() throws InitializationException { urlFailureCache = (UrlFailureCache) springFactory.lookup( urlFailureCache ); } The next thing we should probably try is using something like SpringCache as suggested to remove the plexus-cache dependency. Have fun! Cheers, Brett -- Brett Porter [EMAIL PROTECTED] http://blogs.exist.com/bporter/ -- Cordialement, Ludo - http://www.ubik-products.com --- L'amour pour principe et l'ordre pour base; le progres pour but (A.Comte) -- Cordialement, Ludo - http://www.ubik-products.com --- L'amour pour principe et l'ordre pour base; le progres pour but (A.Comte)
Re: [OT] Re: An experiment with Spring... What about OSGi ?
OK, this is just my personal opinion: I think choice of Spring OSGi is influenced by a few things: 1) Archiva is looking to garner more contributions from the community. Moving to Spring would, IMO, definately lessen the learning curve. There is a comprehensive documentation and large user base who work with Spring. Regards choice of Spring DM for OSGi, you might want to have a look here: http://static.springframework.org/osgi/docs/1.0/reference/html/why-spring-dm.html 2) Plexus is good but not as comprehensively documented. (I admit I haven't sustained in doing my bit with the documentation there). 3) May be others can chip with their thoughts on Modello. But I think Modello could be dropped by using JPA annotations for the data model. Cheers, Rahul Ludovic Maitre wrote: Hi Carlos, Thanks for your answer, Carlos Sanchez a écrit : spring has good integration with OSGi to enable Spring beans to be OSGi services. Yes, i'm aware that this integration exist and i've read a couple of meetings reports related to it on the Equinox wiki, but why bother with the complicated Spring xml descriptors (well for me i admit that i haven't tried Spring since v1.2 iirc), is there any need in Archiva which is not adressed by OSGi (Felix/Sling for instance) + Modello ? I'm wondering what are the benefits of Spring (even with OSGi integration) regarding the current Plexus architecture or an alternative architecture based on some OSGi layer, which features does bring Spring which are not implemented in the other frameworks (including modello) ? Best regards, thanks for your time, On Mon, Feb 25, 2008 at 11:05 AM, Ludovic Maitre [EMAIL PROTECTED] wrote: Hi Brett, all, Have you considered using OSGi instead of [Plexus|Spring] ? I'm not an expert of one or the other, but i try to do some projects with OSGi since a few months and i like it. Best regards, Brett Porter a écrit : Hi, Given the discussion yesterday, I played around with some changes on a branch when I got up early this morning to show how we could do a partial migration to Spring without having to do it all at once. https://svn.apache.org/repos/asf/maven/archiva/branches/springy This shows: - ability to lookup plexus components via spring IoC - ability to lookup spring beans during the Plexus component lifecycle - basic functional setup for Spring in the Archiva application Eventually, as whole subsystems no longer require plexus it will be possible to clean it up, such as: - get rid of the additional lookups - use annotations for configuration - use testng + get/set + mocks for the tests where possible (and spring testcontext where integration testing is needed) Here is how to obtain a plexus object from Spring (note there is some pre-req setup in test cases you'll see in the commit, as there is in the additional servlet listener): bean id=urlCache factory-bean=plexusCacheFactory factory-method=createInstance / bean id=plexusCacheFactory class=org.apache.maven.archiva.common.spring.PlexusFactory constructor-arg index=0 value=org.codehaus.plexus.cache.Cache/ constructor-arg index=1 value=url-failures-cache/ /bean To get a spring bean inside a plexus component, it is like this (make sure to implement Initializable): /** * @plexus.requirement */ private SpringFactory springFactory; public void initialize() throws InitializationException { urlFailureCache = (UrlFailureCache) springFactory.lookup( urlFailureCache ); } The next thing we should probably try is using something like SpringCache as suggested to remove the plexus-cache dependency. Have fun! Cheers, Brett -- Brett Porter [EMAIL PROTECTED] http://blogs.exist.com/bporter/ -- Cordialement, Ludo - http://www.ubik-products.com --- L'amour pour principe et l'ordre pour base; le progres pour but (A.Comte)
Re: [OT] Re: An experiment with Spring... What about OSGi ?
spring has good integration with OSGi to enable Spring beans to be OSGi services. On Mon, Feb 25, 2008 at 11:05 AM, Ludovic Maitre [EMAIL PROTECTED] wrote: Hi Brett, all, Have you considered using OSGi instead of [Plexus|Spring] ? I'm not an expert of one or the other, but i try to do some projects with OSGi since a few months and i like it. Best regards, Brett Porter a écrit : Hi, Given the discussion yesterday, I played around with some changes on a branch when I got up early this morning to show how we could do a partial migration to Spring without having to do it all at once. https://svn.apache.org/repos/asf/maven/archiva/branches/springy This shows: - ability to lookup plexus components via spring IoC - ability to lookup spring beans during the Plexus component lifecycle - basic functional setup for Spring in the Archiva application Eventually, as whole subsystems no longer require plexus it will be possible to clean it up, such as: - get rid of the additional lookups - use annotations for configuration - use testng + get/set + mocks for the tests where possible (and spring testcontext where integration testing is needed) Here is how to obtain a plexus object from Spring (note there is some pre-req setup in test cases you'll see in the commit, as there is in the additional servlet listener): bean id=urlCache factory-bean=plexusCacheFactory factory-method=createInstance / bean id=plexusCacheFactory class=org.apache.maven.archiva.common.spring.PlexusFactory constructor-arg index=0 value=org.codehaus.plexus.cache.Cache/ constructor-arg index=1 value=url-failures-cache/ /bean To get a spring bean inside a plexus component, it is like this (make sure to implement Initializable): /** * @plexus.requirement */ private SpringFactory springFactory; public void initialize() throws InitializationException { urlFailureCache = (UrlFailureCache) springFactory.lookup( urlFailureCache ); } The next thing we should probably try is using something like SpringCache as suggested to remove the plexus-cache dependency. Have fun! Cheers, Brett -- Brett Porter [EMAIL PROTECTED] http://blogs.exist.com/bporter/ -- Cordialement, Ludo - http://www.ubik-products.com --- L'amour pour principe et l'ordre pour base; le progres pour but (A.Comte) -- I could give you my word as a Spaniard. No good. I've known too many Spaniards. -- The Princess Bride