You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by Guillaume Nodet <gn...@apache.org> on 2015/11/20 17:56:51 UTC

[DISCUSS] Spring support in Blueprint

I've just committed a new module (and the additional required changes and
existing modules) to support Spring namespaces (default and custom) in
blueprint.
See the source code at

http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/

It's limited and not much tested for now, but it can handle things like the
following:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:bean="http://camel.apache.org/schema/blueprint"
  xmlns:util="http://www.springframework.org/schema/util"
           xsi:schemaLocation="
             http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
             http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
             http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
             http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-4.2.xsd
             http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">

    <!-- plain blueprint bean referencing a spring bean -->
    <bean id="artemis" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsConnectionFactory"/>
    </bean>

    <!-- spring bean -->
    <bean name="jmsConnectionFactory"
class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
factory-method="createConnectionFactory" xmlns="
http://www.springframework.org/schema/beans">
<constructor-arg value="tcp://0.0.0.0:61616?user=karaf&amp;password=karaf"/>
<constructor-arg value="broker"/>
    </bean>

    <!-- spring bean using custom namespace, referencing spring and
blueprint beans -->
    <util:list id="springList" xmlns="
http://www.springframework.org/schema/beans">
<value>foo</value>
<ref bean="jmsConnectionFactory" />
<ref bean="artemis"/>
    </util:list>

    <!-- blueprint service referencing a spring bean -->
    <service ref="springList" auto-export="all-classes"/>

</blueprint>


So you can use the default spring namespace or custom spring namespaces and
cross-reference beans between blueprint and spring.

I haven't tried auto-wiring or any advanced usage such as AOP.

I'll try to commit a few initial integration tests beginning of next week.
Please have a look and provide feedback and additional use cases (as tests
?).

Cheers,
Guillaume Nodet

Re: [DISCUSS] Spring support in Blueprint

Posted by Achim Nierbeck <bc...@googlemail.com>.
Cool .. as soon as possible I'll give it a try :-)

regards, Achim


2015-11-23 9:56 GMT+01:00 Guillaume Nodet <gn...@apache.org>:

> I've added a simple test case demonstrating the use of blueprint-spring:
>
>
> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/test/resources/test1.xml?revision=1715737&view=markup
>
> Guillaume
>
>
> 2015-11-20 17:56 GMT+01:00 Guillaume Nodet <gn...@apache.org>:
>
> > I've just committed a new module (and the additional required changes and
> > existing modules) to support Spring namespaces (default and custom) in
> > blueprint.
> > See the source code at
> >
> >
> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/
> >
> > It's limited and not much tested for now, but it can handle things like
> > the following:
> >
> > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> >            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >   xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> >   xmlns:bean="http://camel.apache.org/schema/blueprint"
> >   xmlns:util="http://www.springframework.org/schema/util"
> >            xsi:schemaLocation="
> >              http://www.osgi.org/xmlns/blueprint/v1.0.0
> > http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
> >              http://camel.apache.org/schema/blueprint
> > http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
> >              http://www.springframework.org/schema/tx
> > http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
> >              http://www.springframework.org/schema/util
> > http://www.springframework.org/schema/util/spring-util-4.2.xsd
> >              http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
> >
> >     <!-- plain blueprint bean referencing a spring bean -->
> >     <bean id="artemis"
> class="org.apache.camel.component.jms.JmsComponent">
> > <property name="connectionFactory" ref="jmsConnectionFactory"/>
> >     </bean>
> >
> >     <!-- spring bean -->
> >     <bean name="jmsConnectionFactory"
> > class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
> > factory-method="createConnectionFactory" xmlns="
> > http://www.springframework.org/schema/beans">
> > <constructor-arg value="tcp://
> 0.0.0.0:61616?user=karaf&amp;password=karaf
> > "/>
> > <constructor-arg value="broker"/>
> >     </bean>
> >
> >     <!-- spring bean using custom namespace, referencing spring and
> > blueprint beans -->
> >     <util:list id="springList" xmlns="
> > http://www.springframework.org/schema/beans">
> > <value>foo</value>
> > <ref bean="jmsConnectionFactory" />
> > <ref bean="artemis"/>
> >     </util:list>
> >
> >     <!-- blueprint service referencing a spring bean -->
> >     <service ref="springList" auto-export="all-classes"/>
> >
> > </blueprint>
> >
> >
> > So you can use the default spring namespace or custom spring namespaces
> > and cross-reference beans between blueprint and spring.
> >
> > I haven't tried auto-wiring or any advanced usage such as AOP.
> >
> > I'll try to commit a few initial integration tests beginning of next
> week.
> > Please have a look and provide feedback and additional use cases (as
> tests
> > ?).
> >
> > Cheers,
> > Guillaume Nodet
> >
> >
> >
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Re: [DISCUSS] Spring support in Blueprint

Posted by Achim Nierbeck <bc...@googlemail.com>.
Cool .. as soon as possible I'll give it a try :-)

regards, Achim


2015-11-23 9:56 GMT+01:00 Guillaume Nodet <gn...@apache.org>:

> I've added a simple test case demonstrating the use of blueprint-spring:
>
>
> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/test/resources/test1.xml?revision=1715737&view=markup
>
> Guillaume
>
>
> 2015-11-20 17:56 GMT+01:00 Guillaume Nodet <gn...@apache.org>:
>
> > I've just committed a new module (and the additional required changes and
> > existing modules) to support Spring namespaces (default and custom) in
> > blueprint.
> > See the source code at
> >
> >
> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/
> >
> > It's limited and not much tested for now, but it can handle things like
> > the following:
> >
> > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> >            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >   xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> >   xmlns:bean="http://camel.apache.org/schema/blueprint"
> >   xmlns:util="http://www.springframework.org/schema/util"
> >            xsi:schemaLocation="
> >              http://www.osgi.org/xmlns/blueprint/v1.0.0
> > http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
> >              http://camel.apache.org/schema/blueprint
> > http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
> >              http://www.springframework.org/schema/tx
> > http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
> >              http://www.springframework.org/schema/util
> > http://www.springframework.org/schema/util/spring-util-4.2.xsd
> >              http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
> >
> >     <!-- plain blueprint bean referencing a spring bean -->
> >     <bean id="artemis"
> class="org.apache.camel.component.jms.JmsComponent">
> > <property name="connectionFactory" ref="jmsConnectionFactory"/>
> >     </bean>
> >
> >     <!-- spring bean -->
> >     <bean name="jmsConnectionFactory"
> > class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
> > factory-method="createConnectionFactory" xmlns="
> > http://www.springframework.org/schema/beans">
> > <constructor-arg value="tcp://
> 0.0.0.0:61616?user=karaf&amp;password=karaf
> > "/>
> > <constructor-arg value="broker"/>
> >     </bean>
> >
> >     <!-- spring bean using custom namespace, referencing spring and
> > blueprint beans -->
> >     <util:list id="springList" xmlns="
> > http://www.springframework.org/schema/beans">
> > <value>foo</value>
> > <ref bean="jmsConnectionFactory" />
> > <ref bean="artemis"/>
> >     </util:list>
> >
> >     <!-- blueprint service referencing a spring bean -->
> >     <service ref="springList" auto-export="all-classes"/>
> >
> > </blueprint>
> >
> >
> > So you can use the default spring namespace or custom spring namespaces
> > and cross-reference beans between blueprint and spring.
> >
> > I haven't tried auto-wiring or any advanced usage such as AOP.
> >
> > I'll try to commit a few initial integration tests beginning of next
> week.
> > Please have a look and provide feedback and additional use cases (as
> tests
> > ?).
> >
> > Cheers,
> > Guillaume Nodet
> >
> >
> >
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Re: [DISCUSS] Spring support in Blueprint

Posted by Guillaume Nodet <gn...@apache.org>.
I've added a simple test case demonstrating the use of blueprint-spring:

http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/test/resources/test1.xml?revision=1715737&view=markup

Guillaume


2015-11-20 17:56 GMT+01:00 Guillaume Nodet <gn...@apache.org>:

> I've just committed a new module (and the additional required changes and
> existing modules) to support Spring namespaces (default and custom) in
> blueprint.
> See the source code at
>
> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/
>
> It's limited and not much tested for now, but it can handle things like
> the following:
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>   xmlns:bean="http://camel.apache.org/schema/blueprint"
>   xmlns:util="http://www.springframework.org/schema/util"
>            xsi:schemaLocation="
>              http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>              http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>              http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
>              http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util-4.2.xsd
>              http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
>
>     <!-- plain blueprint bean referencing a spring bean -->
>     <bean id="artemis" class="org.apache.camel.component.jms.JmsComponent">
> <property name="connectionFactory" ref="jmsConnectionFactory"/>
>     </bean>
>
>     <!-- spring bean -->
>     <bean name="jmsConnectionFactory"
> class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
> factory-method="createConnectionFactory" xmlns="
> http://www.springframework.org/schema/beans">
> <constructor-arg value="tcp://0.0.0.0:61616?user=karaf&amp;password=karaf
> "/>
> <constructor-arg value="broker"/>
>     </bean>
>
>     <!-- spring bean using custom namespace, referencing spring and
> blueprint beans -->
>     <util:list id="springList" xmlns="
> http://www.springframework.org/schema/beans">
> <value>foo</value>
> <ref bean="jmsConnectionFactory" />
> <ref bean="artemis"/>
>     </util:list>
>
>     <!-- blueprint service referencing a spring bean -->
>     <service ref="springList" auto-export="all-classes"/>
>
> </blueprint>
>
>
> So you can use the default spring namespace or custom spring namespaces
> and cross-reference beans between blueprint and spring.
>
> I haven't tried auto-wiring or any advanced usage such as AOP.
>
> I'll try to commit a few initial integration tests beginning of next week.
> Please have a look and provide feedback and additional use cases (as tests
> ?).
>
> Cheers,
> Guillaume Nodet
>
>
>

Re: [DISCUSS] Spring support in Blueprint

Posted by Guillaume Nodet <gn...@apache.org>.
Currently, both namespaces would be available as OSGi services.
This should mean that the namespace that has been registered first will be
used (as both should be compatible with the blueprint bundle I suppose).

In this very case and in the current state of blueprint-spring, I think the
spring one will be  registered first, because it's registered when the
BundleEvent.STARTING event is fired, while the cxf blueprint namespace will
be registered just after by the activator.

Do you foresee any problem with using one or the other namespace ?

I could also add some tricks to make sure we select the "native" blueprint
namespace in such cases.

Guillaume


2015-11-23 18:35 GMT+01:00 Daniel Kulp <dk...@apache.org>:

>
> Guillaume,
>
> Question:  CXF uses the same namespace in some cases for both Blueprint
> and Spring.   Any idea on how this would handle that?  Would it invoke the
> Spring parser or the Blueprint parser?
>
> Dan
>
>
>
> > On Nov 23, 2015, at 9:13 AM, Guillaume Nodet <gn...@apache.org> wrote:
> >
> > Yeah, it's not really needed.
> > That's just what fileinstall does in karaf when dropping a single
> blueprint
> > xml in the deploy folder, and that's what I used during initial testing.
> > For a real bundle, that's definitely not needed.
> > I've committed a real integration test which demonstrates a better
> scenario
> > (which does not include the dynamic imports).
> >
> > Guillaume
> >
> > 2015-11-23 15:02 GMT+01:00 David Bosschaert <david.bosschaert@gmail.com
> >:
> >
> >> Hi Guillaume,
> >>
> >> On 23 November 2015 at 04:03, Guillaume Nodet <gn...@apache.org>
> wrote:
> >>> Good point, I haven't really tested this part specifically.
> >>> I've used the spring deployer to deploy my test xml in karaf, so afaik,
> >> it
> >>> uses a dynamicimport-package=*, so I'm not sure about the exact
> behaviour
> >>> yet.
> >>
> >> Can we avoid dynamicimport-package=* somehow? Using that you really
> >> throw all of the OSGi modularity out of the window.
> >> dynamicimport-package=* should be avoided at all times IMHO...
> >>
> >> David
> >>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>

Re: [DISCUSS] Spring support in Blueprint

Posted by Daniel Kulp <dk...@apache.org>.
Guillaume,

Question:  CXF uses the same namespace in some cases for both Blueprint and Spring.   Any idea on how this would handle that?  Would it invoke the Spring parser or the Blueprint parser?

Dan



> On Nov 23, 2015, at 9:13 AM, Guillaume Nodet <gn...@apache.org> wrote:
> 
> Yeah, it's not really needed.
> That's just what fileinstall does in karaf when dropping a single blueprint
> xml in the deploy folder, and that's what I used during initial testing.
> For a real bundle, that's definitely not needed.
> I've committed a real integration test which demonstrates a better scenario
> (which does not include the dynamic imports).
> 
> Guillaume
> 
> 2015-11-23 15:02 GMT+01:00 David Bosschaert <da...@gmail.com>:
> 
>> Hi Guillaume,
>> 
>> On 23 November 2015 at 04:03, Guillaume Nodet <gn...@apache.org> wrote:
>>> Good point, I haven't really tested this part specifically.
>>> I've used the spring deployer to deploy my test xml in karaf, so afaik,
>> it
>>> uses a dynamicimport-package=*, so I'm not sure about the exact behaviour
>>> yet.
>> 
>> Can we avoid dynamicimport-package=* somehow? Using that you really
>> throw all of the OSGi modularity out of the window.
>> dynamicimport-package=* should be avoided at all times IMHO...
>> 
>> David
>> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: [DISCUSS] Spring support in Blueprint

Posted by Guillaume Nodet <gn...@apache.org>.
Yeah, it's not really needed.
That's just what fileinstall does in karaf when dropping a single blueprint
xml in the deploy folder, and that's what I used during initial testing.
For a real bundle, that's definitely not needed.
I've committed a real integration test which demonstrates a better scenario
(which does not include the dynamic imports).

Guillaume

2015-11-23 15:02 GMT+01:00 David Bosschaert <da...@gmail.com>:

> Hi Guillaume,
>
> On 23 November 2015 at 04:03, Guillaume Nodet <gn...@apache.org> wrote:
> > Good point, I haven't really tested this part specifically.
> > I've used the spring deployer to deploy my test xml in karaf, so afaik,
> it
> > uses a dynamicimport-package=*, so I'm not sure about the exact behaviour
> > yet.
>
> Can we avoid dynamicimport-package=* somehow? Using that you really
> throw all of the OSGi modularity out of the window.
> dynamicimport-package=* should be avoided at all times IMHO...
>
> David
>

Reply: Re: Reply: Re: [DISCUSS] Spring support in Blueprint

Posted by 仓央杰克 <lq...@126.com>.
i will test.thanks.
此邮件来自易信 - 点击下载,体验邮件随身提醒!



在2015年11月23日 22:17:07, "Guillaume Nodet" <gn...@apache.org> 写道:

> Here's the bundle deployed for integration testing:
>
> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundles/
>
> Note that it uses but I just used it to test class
> loading. There's currently no support for load time weaving of bundles
> using aop.
>
>
> 2015-11-23 15:12 GMT+01:00 仓央杰克 :
>
> >
> > hi,
> > how can you combination the spring and aries?
> > 此邮件来自易信
> > 网易邮箱推出官方手机客户端--邮箱大师 马上体验
> >
> >
> >
> > 在2015年11月23日 22:02:54, "David Bosschaert" 写道:
> >
> > > Hi Guillaume,
> > >
> > > On 23 November 2015 at 04:03, Guillaume Nodet wrote:
> > > > Good point, I haven't really tested this part specifically.
> > > > I've used the spring deployer to deploy my test xml in karaf, so
> > afaik, it
> > > > uses a dynamicimport-package=*, so I'm not sure about the exact
> > behaviour
> > > > yet.
> > >
> > > Can we avoid dynamicimport-package=* somehow? Using that you really
> > > throw all of the OSGi modularity out of the window.
> > > dynamicimport-package=* should be avoided at all times IMHO...
> > >
> > > David
> >

Re: Reply: Re: [DISCUSS] Spring support in Blueprint

Posted by Guillaume Nodet <gn...@apache.org>.
Here's the bundle deployed for integration testing:

http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundles/

Note that it uses <annotation-driven/> but I just used it to test class
loading.  There's currently no support for load time weaving of bundles
using aop.


2015-11-23 15:12 GMT+01:00 仓央杰克 <lq...@126.com>:

>
> hi,
> how can you combination the spring and aries?
> 此邮件来自易信
> 网易邮箱推出官方手机客户端--邮箱大师 马上体验
>
>
>
> 在2015年11月23日 22:02:54, "David Bosschaert" <da...@gmail.com> 写道:
>
> > Hi Guillaume,
> >
> > On 23 November 2015 at 04:03, Guillaume Nodet wrote:
> > > Good point, I haven't really tested this part specifically.
> > > I've used the spring deployer to deploy my test xml in karaf, so
> afaik, it
> > > uses a dynamicimport-package=*, so I'm not sure about the exact
> behaviour
> > > yet.
> >
> > Can we avoid dynamicimport-package=* somehow? Using that you really
> > throw all of the OSGi modularity out of the window.
> > dynamicimport-package=* should be avoided at all times IMHO...
> >
> > David
>

Reply: Re: [DISCUSS] Spring support in Blueprint

Posted by 仓央杰克 <lq...@126.com>.
hi,
how can you combination the spring and aries?
此邮件来自易信
网易邮箱推出官方手机客户端--邮箱大师 马上体验



在2015年11月23日 22:02:54, "David Bosschaert" <da...@gmail.com> 写道:

> Hi Guillaume,
>
> On 23 November 2015 at 04:03, Guillaume Nodet wrote:
> > Good point, I haven't really tested this part specifically.
> > I've used the spring deployer to deploy my test xml in karaf, so afaik, it
> > uses a dynamicimport-package=*, so I'm not sure about the exact behaviour
> > yet.
>
> Can we avoid dynamicimport-package=* somehow? Using that you really
> throw all of the OSGi modularity out of the window.
> dynamicimport-package=* should be avoided at all times IMHO...
>
> David

Re: [DISCUSS] Spring support in Blueprint

Posted by David Bosschaert <da...@gmail.com>.
Hi Guillaume,

On 23 November 2015 at 04:03, Guillaume Nodet <gn...@apache.org> wrote:
> Good point, I haven't really tested this part specifically.
> I've used the spring deployer to deploy my test xml in karaf, so afaik, it
> uses a dynamicimport-package=*, so I'm not sure about the exact behaviour
> yet.

Can we avoid dynamicimport-package=* somehow? Using that you really
throw all of the OSGi modularity out of the window.
dynamicimport-package=* should be avoided at all times IMHO...

David

Re: [DISCUSS] Spring support in Blueprint

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
That's really great !

Thanks !
Regards
JB

On 11/23/2015 02:57 PM, Guillaume Nodet wrote:
> That's now fixed.  The custom namespaces do contribute to the blueprint
> container class loader.
>
> 2015-11-23 11:03 GMT+01:00 Guillaume Nodet <gn...@apache.org>:
>
>> Good point, I haven't really tested this part specifically.
>> I've used the spring deployer to deploy my test xml in karaf, so afaik, it
>> uses a dynamicimport-package=*, so I'm not sure about the exact behaviour
>> yet.
>> In all cases, I think we should be able to solve that problem, because the
>> spring application context will actually create the spring beans, so we do
>> have control over the class loader here.  It should be possible to inject a
>> class loader what will be able to delegate to the blueprint bundle class
>> loader and to the various spring namespace bundles, so that importing the
>> packages should not be necessary.
>> I'll try to create an integration test to verify that.
>>
>> Guillaume
>>
>> 2015-11-23 10:19 GMT+01:00 Christian Schneider <ch...@die-schneider.net>:
>>
>>> I would not have thought that it is possible to combine Aries Blueprint
>>> and spring namespaces.
>>> All the better that it seems to work :-)
>>>
>>> How do you solve the classloader problem? Does the blueprint approach
>>> still have the same issues as spring dm? So does the user still
>>> have to make sure all internals the namespace needs are imported?
>>>
>>> Christian
>>>
>>>
>>>
>>> On 20.11.2015 17:56, Guillaume Nodet wrote:
>>>
>>>> I've just committed a new module (and the additional required changes and
>>>> existing modules) to support Spring namespaces (default and custom) in
>>>> blueprint.
>>>> See the source code at
>>>>
>>>>
>>>> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/
>>>>
>>>> It's limited and not much tested for now, but it can handle things like
>>>> the
>>>> following:
>>>>
>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>     xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>     xmlns:bean="http://camel.apache.org/schema/blueprint"
>>>>     xmlns:util="http://www.springframework.org/schema/util"
>>>>              xsi:schemaLocation="
>>>>                http://www.osgi.org/xmlns/blueprint/v1.0.0
>>>> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>>>>                http://camel.apache.org/schema/blueprint
>>>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>>>>                http://www.springframework.org/schema/tx
>>>> http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
>>>>                http://www.springframework.org/schema/util
>>>> http://www.springframework.org/schema/util/spring-util-4.2.xsd
>>>>                http://www.springframework.org/schema/beans
>>>> http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
>>>>
>>>>       <!-- plain blueprint bean referencing a spring bean -->
>>>>       <bean id="artemis"
>>>> class="org.apache.camel.component.jms.JmsComponent">
>>>> <property name="connectionFactory" ref="jmsConnectionFactory"/>
>>>>       </bean>
>>>>
>>>>       <!-- spring bean -->
>>>>       <bean name="jmsConnectionFactory"
>>>> class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
>>>> factory-method="createConnectionFactory" xmlns="
>>>> http://www.springframework.org/schema/beans">
>>>> <constructor-arg value="tcp://
>>>> 0.0.0.0:61616?user=karaf&amp;password=karaf"/>
>>>> <constructor-arg value="broker"/>
>>>>       </bean>
>>>>
>>>>       <!-- spring bean using custom namespace, referencing spring and
>>>> blueprint beans -->
>>>>       <util:list id="springList" xmlns="
>>>> http://www.springframework.org/schema/beans">
>>>> <value>foo</value>
>>>> <ref bean="jmsConnectionFactory" />
>>>> <ref bean="artemis"/>
>>>>       </util:list>
>>>>
>>>>       <!-- blueprint service referencing a spring bean -->
>>>>       <service ref="springList" auto-export="all-classes"/>
>>>>
>>>> </blueprint>
>>>>
>>>>
>>>> So you can use the default spring namespace or custom spring namespaces
>>>> and
>>>> cross-reference beans between blueprint and spring.
>>>>
>>>> I haven't tried auto-wiring or any advanced usage such as AOP.
>>>>
>>>> I'll try to commit a few initial integration tests beginning of next
>>>> week.
>>>> Please have a look and provide feedback and additional use cases (as
>>>> tests
>>>> ?).
>>>>
>>>> Cheers,
>>>> Guillaume Nodet
>>>>
>>>>
>>>
>>> --
>>> Christian Schneider
>>> http://www.liquid-reality.de
>>>
>>> Open Source Architect
>>> http://www.talend.com
>>>
>>>
>>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: [DISCUSS] Spring support in Blueprint

Posted by Guillaume Nodet <gn...@apache.org>.
That's now fixed.  The custom namespaces do contribute to the blueprint
container class loader.

2015-11-23 11:03 GMT+01:00 Guillaume Nodet <gn...@apache.org>:

> Good point, I haven't really tested this part specifically.
> I've used the spring deployer to deploy my test xml in karaf, so afaik, it
> uses a dynamicimport-package=*, so I'm not sure about the exact behaviour
> yet.
> In all cases, I think we should be able to solve that problem, because the
> spring application context will actually create the spring beans, so we do
> have control over the class loader here.  It should be possible to inject a
> class loader what will be able to delegate to the blueprint bundle class
> loader and to the various spring namespace bundles, so that importing the
> packages should not be necessary.
> I'll try to create an integration test to verify that.
>
> Guillaume
>
> 2015-11-23 10:19 GMT+01:00 Christian Schneider <ch...@die-schneider.net>:
>
>> I would not have thought that it is possible to combine Aries Blueprint
>> and spring namespaces.
>> All the better that it seems to work :-)
>>
>> How do you solve the classloader problem? Does the blueprint approach
>> still have the same issues as spring dm? So does the user still
>> have to make sure all internals the namespace needs are imported?
>>
>> Christian
>>
>>
>>
>> On 20.11.2015 17:56, Guillaume Nodet wrote:
>>
>>> I've just committed a new module (and the additional required changes and
>>> existing modules) to support Spring namespaces (default and custom) in
>>> blueprint.
>>> See the source code at
>>>
>>>
>>> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/
>>>
>>> It's limited and not much tested for now, but it can handle things like
>>> the
>>> following:
>>>
>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>    xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>    xmlns:bean="http://camel.apache.org/schema/blueprint"
>>>    xmlns:util="http://www.springframework.org/schema/util"
>>>             xsi:schemaLocation="
>>>               http://www.osgi.org/xmlns/blueprint/v1.0.0
>>> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>>>               http://camel.apache.org/schema/blueprint
>>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>>>               http://www.springframework.org/schema/tx
>>> http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
>>>               http://www.springframework.org/schema/util
>>> http://www.springframework.org/schema/util/spring-util-4.2.xsd
>>>               http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
>>>
>>>      <!-- plain blueprint bean referencing a spring bean -->
>>>      <bean id="artemis"
>>> class="org.apache.camel.component.jms.JmsComponent">
>>> <property name="connectionFactory" ref="jmsConnectionFactory"/>
>>>      </bean>
>>>
>>>      <!-- spring bean -->
>>>      <bean name="jmsConnectionFactory"
>>> class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
>>> factory-method="createConnectionFactory" xmlns="
>>> http://www.springframework.org/schema/beans">
>>> <constructor-arg value="tcp://
>>> 0.0.0.0:61616?user=karaf&amp;password=karaf"/>
>>> <constructor-arg value="broker"/>
>>>      </bean>
>>>
>>>      <!-- spring bean using custom namespace, referencing spring and
>>> blueprint beans -->
>>>      <util:list id="springList" xmlns="
>>> http://www.springframework.org/schema/beans">
>>> <value>foo</value>
>>> <ref bean="jmsConnectionFactory" />
>>> <ref bean="artemis"/>
>>>      </util:list>
>>>
>>>      <!-- blueprint service referencing a spring bean -->
>>>      <service ref="springList" auto-export="all-classes"/>
>>>
>>> </blueprint>
>>>
>>>
>>> So you can use the default spring namespace or custom spring namespaces
>>> and
>>> cross-reference beans between blueprint and spring.
>>>
>>> I haven't tried auto-wiring or any advanced usage such as AOP.
>>>
>>> I'll try to commit a few initial integration tests beginning of next
>>> week.
>>> Please have a look and provide feedback and additional use cases (as
>>> tests
>>> ?).
>>>
>>> Cheers,
>>> Guillaume Nodet
>>>
>>>
>>
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>>
>> Open Source Architect
>> http://www.talend.com
>>
>>
>

Re: [DISCUSS] Spring support in Blueprint

Posted by Guillaume Nodet <gn...@apache.org>.
Good point, I haven't really tested this part specifically.
I've used the spring deployer to deploy my test xml in karaf, so afaik, it
uses a dynamicimport-package=*, so I'm not sure about the exact behaviour
yet.
In all cases, I think we should be able to solve that problem, because the
spring application context will actually create the spring beans, so we do
have control over the class loader here.  It should be possible to inject a
class loader what will be able to delegate to the blueprint bundle class
loader and to the various spring namespace bundles, so that importing the
packages should not be necessary.
I'll try to create an integration test to verify that.

Guillaume

2015-11-23 10:19 GMT+01:00 Christian Schneider <ch...@die-schneider.net>:

> I would not have thought that it is possible to combine Aries Blueprint
> and spring namespaces.
> All the better that it seems to work :-)
>
> How do you solve the classloader problem? Does the blueprint approach
> still have the same issues as spring dm? So does the user still
> have to make sure all internals the namespace needs are imported?
>
> Christian
>
>
>
> On 20.11.2015 17:56, Guillaume Nodet wrote:
>
>> I've just committed a new module (and the additional required changes and
>> existing modules) to support Spring namespaces (default and custom) in
>> blueprint.
>> See the source code at
>>
>>
>> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/
>>
>> It's limited and not much tested for now, but it can handle things like
>> the
>> following:
>>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>    xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>    xmlns:bean="http://camel.apache.org/schema/blueprint"
>>    xmlns:util="http://www.springframework.org/schema/util"
>>             xsi:schemaLocation="
>>               http://www.osgi.org/xmlns/blueprint/v1.0.0
>> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>>               http://camel.apache.org/schema/blueprint
>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>>               http://www.springframework.org/schema/tx
>> http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
>>               http://www.springframework.org/schema/util
>> http://www.springframework.org/schema/util/spring-util-4.2.xsd
>>               http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
>>
>>      <!-- plain blueprint bean referencing a spring bean -->
>>      <bean id="artemis"
>> class="org.apache.camel.component.jms.JmsComponent">
>> <property name="connectionFactory" ref="jmsConnectionFactory"/>
>>      </bean>
>>
>>      <!-- spring bean -->
>>      <bean name="jmsConnectionFactory"
>> class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
>> factory-method="createConnectionFactory" xmlns="
>> http://www.springframework.org/schema/beans">
>> <constructor-arg value="tcp://0.0.0.0:61616?user=karaf&amp;password=karaf
>> "/>
>> <constructor-arg value="broker"/>
>>      </bean>
>>
>>      <!-- spring bean using custom namespace, referencing spring and
>> blueprint beans -->
>>      <util:list id="springList" xmlns="
>> http://www.springframework.org/schema/beans">
>> <value>foo</value>
>> <ref bean="jmsConnectionFactory" />
>> <ref bean="artemis"/>
>>      </util:list>
>>
>>      <!-- blueprint service referencing a spring bean -->
>>      <service ref="springList" auto-export="all-classes"/>
>>
>> </blueprint>
>>
>>
>> So you can use the default spring namespace or custom spring namespaces
>> and
>> cross-reference beans between blueprint and spring.
>>
>> I haven't tried auto-wiring or any advanced usage such as AOP.
>>
>> I'll try to commit a few initial integration tests beginning of next week.
>> Please have a look and provide feedback and additional use cases (as tests
>> ?).
>>
>> Cheers,
>> Guillaume Nodet
>>
>>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>
>

Re: [DISCUSS] Spring support in Blueprint

Posted by Christian Schneider <ch...@die-schneider.net>.
I would not have thought that it is possible to combine Aries Blueprint 
and spring namespaces.
All the better that it seems to work :-)

How do you solve the classloader problem? Does the blueprint approach 
still have the same issues as spring dm? So does the user still
have to make sure all internals the namespace needs are imported?

Christian


On 20.11.2015 17:56, Guillaume Nodet wrote:
> I've just committed a new module (and the additional required changes and
> existing modules) to support Spring namespaces (default and custom) in
> blueprint.
> See the source code at
>
> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/
>
> It's limited and not much tested for now, but it can handle things like the
> following:
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>    xmlns:bean="http://camel.apache.org/schema/blueprint"
>    xmlns:util="http://www.springframework.org/schema/util"
>             xsi:schemaLocation="
>               http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>               http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>               http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
>               http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util-4.2.xsd
>               http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
>
>      <!-- plain blueprint bean referencing a spring bean -->
>      <bean id="artemis" class="org.apache.camel.component.jms.JmsComponent">
> <property name="connectionFactory" ref="jmsConnectionFactory"/>
>      </bean>
>
>      <!-- spring bean -->
>      <bean name="jmsConnectionFactory"
> class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
> factory-method="createConnectionFactory" xmlns="
> http://www.springframework.org/schema/beans">
> <constructor-arg value="tcp://0.0.0.0:61616?user=karaf&amp;password=karaf"/>
> <constructor-arg value="broker"/>
>      </bean>
>
>      <!-- spring bean using custom namespace, referencing spring and
> blueprint beans -->
>      <util:list id="springList" xmlns="
> http://www.springframework.org/schema/beans">
> <value>foo</value>
> <ref bean="jmsConnectionFactory" />
> <ref bean="artemis"/>
>      </util:list>
>
>      <!-- blueprint service referencing a spring bean -->
>      <service ref="springList" auto-export="all-classes"/>
>
> </blueprint>
>
>
> So you can use the default spring namespace or custom spring namespaces and
> cross-reference beans between blueprint and spring.
>
> I haven't tried auto-wiring or any advanced usage such as AOP.
>
> I'll try to commit a few initial integration tests beginning of next week.
> Please have a look and provide feedback and additional use cases (as tests
> ?).
>
> Cheers,
> Guillaume Nodet
>


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: [DISCUSS] Spring support in Blueprint

Posted by Guillaume Nodet <gn...@apache.org>.
I've added a simple test case demonstrating the use of blueprint-spring:

http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/test/resources/test1.xml?revision=1715737&view=markup

Guillaume


2015-11-20 17:56 GMT+01:00 Guillaume Nodet <gn...@apache.org>:

> I've just committed a new module (and the additional required changes and
> existing modules) to support Spring namespaces (default and custom) in
> blueprint.
> See the source code at
>
> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/
>
> It's limited and not much tested for now, but it can handle things like
> the following:
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>   xmlns:bean="http://camel.apache.org/schema/blueprint"
>   xmlns:util="http://www.springframework.org/schema/util"
>            xsi:schemaLocation="
>              http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>              http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>              http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
>              http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util-4.2.xsd
>              http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
>
>     <!-- plain blueprint bean referencing a spring bean -->
>     <bean id="artemis" class="org.apache.camel.component.jms.JmsComponent">
> <property name="connectionFactory" ref="jmsConnectionFactory"/>
>     </bean>
>
>     <!-- spring bean -->
>     <bean name="jmsConnectionFactory"
> class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
> factory-method="createConnectionFactory" xmlns="
> http://www.springframework.org/schema/beans">
> <constructor-arg value="tcp://0.0.0.0:61616?user=karaf&amp;password=karaf
> "/>
> <constructor-arg value="broker"/>
>     </bean>
>
>     <!-- spring bean using custom namespace, referencing spring and
> blueprint beans -->
>     <util:list id="springList" xmlns="
> http://www.springframework.org/schema/beans">
> <value>foo</value>
> <ref bean="jmsConnectionFactory" />
> <ref bean="artemis"/>
>     </util:list>
>
>     <!-- blueprint service referencing a spring bean -->
>     <service ref="springList" auto-export="all-classes"/>
>
> </blueprint>
>
>
> So you can use the default spring namespace or custom spring namespaces
> and cross-reference beans between blueprint and spring.
>
> I haven't tried auto-wiring or any advanced usage such as AOP.
>
> I'll try to commit a few initial integration tests beginning of next week.
> Please have a look and provide feedback and additional use cases (as tests
> ?).
>
> Cheers,
> Guillaume Nodet
>
>
>

Re: [DISCUSS] Spring support in Blueprint

Posted by Guillaume Nodet <gn...@apache.org>.
So auto-wiring and AOP (in particular transactions) are supported for
spring defined beans.

I've done a few tests with cxf and the duplicate namespace handler does not
really seem to cause any issue, even if the one used is currently
undetermined (it depends on the bundle start order between blueprint-spring
/ cxf bundles).  Both namespace handlers seem to behave correctly, but i
have only tested with the cxf config one.

Do you guys see additional use cases to cover ?

2015-11-20 17:56 GMT+01:00 Guillaume Nodet <gn...@apache.org>:

> I've just committed a new module (and the additional required changes and
> existing modules) to support Spring namespaces (default and custom) in
> blueprint.
> See the source code at
>
> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/
>
> It's limited and not much tested for now, but it can handle things like
> the following:
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>   xmlns:bean="http://camel.apache.org/schema/blueprint"
>   xmlns:util="http://www.springframework.org/schema/util"
>            xsi:schemaLocation="
>              http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>              http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>              http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
>              http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util-4.2.xsd
>              http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
>
>     <!-- plain blueprint bean referencing a spring bean -->
>     <bean id="artemis" class="org.apache.camel.component.jms.JmsComponent">
> <property name="connectionFactory" ref="jmsConnectionFactory"/>
>     </bean>
>
>     <!-- spring bean -->
>     <bean name="jmsConnectionFactory"
> class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
> factory-method="createConnectionFactory" xmlns="
> http://www.springframework.org/schema/beans">
> <constructor-arg value="tcp://0.0.0.0:61616?user=karaf&amp;password=karaf
> "/>
> <constructor-arg value="broker"/>
>     </bean>
>
>     <!-- spring bean using custom namespace, referencing spring and
> blueprint beans -->
>     <util:list id="springList" xmlns="
> http://www.springframework.org/schema/beans">
> <value>foo</value>
> <ref bean="jmsConnectionFactory" />
> <ref bean="artemis"/>
>     </util:list>
>
>     <!-- blueprint service referencing a spring bean -->
>     <service ref="springList" auto-export="all-classes"/>
>
> </blueprint>
>
>
> So you can use the default spring namespace or custom spring namespaces
> and cross-reference beans between blueprint and spring.
>
> I haven't tried auto-wiring or any advanced usage such as AOP.
>
> I'll try to commit a few initial integration tests beginning of next week.
> Please have a look and provide feedback and additional use cases (as tests
> ?).
>
> Cheers,
> Guillaume Nodet
>
>
>