You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Charlie Mordant <cm...@gmail.com> on 2015/07/05 17:26:16 UTC

Karaf 4: feature ordering

Hi Karaf experts!

Is there a way to force feature ordering in K4? It was obvious with K3, but
I didn't succeed to mimic it. I tried requirement/capability or
prerequisite="true", but it does not seem to work.

Here's the concrete use case:

I must have <pax-jdbc-config> + <myDsDriver> installed first, then a config
file (the <datasource-definition>), then the openjpa JPA feature and
finally my integration test.


I tried something like this without success (in pseudo xml):

<feature "myItest">
<feature "myDs"/>
<feature "openjpa"/>
<bundle "myTestJar"/>
</feature>

<feature "myDs">
<feature "myDsDriver"/>
<config "myDsConfig"/>
</feature>

<feature "myDsDriver">
<bundle "derby"/>
<feature "pax-jdbc-config"/>
</feature>



Regards,
​Charlie​

-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Re: Karaf 4: feature ordering

Posted by Charlie Mordant <cm...@gmail.com>.
Are the nested feature well ordered with cap/req ?

e.g. Will "AD" starts before "B" in this case?
<feat "A">
<feat "AD">
<cap "com.cap"/>
</feat>

<feat "B">
<req "com.cap"/>
</feat>

Regards,

2015-07-05 21:19 GMT+02:00 Charlie Mordant <cm...@gmail.com>:

> Hi JB,
>
>
>
> Sure!
> In fact I have <cap>db.provider</cap> feature (the pax-jdbc-config one),
> and a <req>db.provider</req> and <cap>datasource.provider</cap> one
> (containing a config property file).
>
>
> I also tweaked the openjpa one to provide an osgiliath.persistence.provider
> (even if it's useless).
>
> Regards,
>
>
> 2015-07-05 20:51 GMT+02:00 Jean-Baptiste Onofré <jb...@nanthrax.net>:
>
>> Hi Charlie,
>>
>> in osgiliath-itests-jpa-jar feature, you added:
>>
>> <requirement>osgiliath.datasource.provider</requirement>
>>
>> Do you have a feature providing:
>>
>> <capability>osgiliath.datasource.provider</capability>
>>
>> Else the resolver won't work a feature matching the requirement.
>>
>> Regards
>> JB
>>
>> On 07/05/2015 08:44 PM, Charlie Mordant wrote:
>>
>>> Hi Jean-Baptiste,
>>>
>>> Kinda strange, I'm already doing it:
>>>
>>> <featurename='osgiliath-itests-jpa-jar'version='${project.version}'>
>>>
>>> <requirement>osgiliath.persistence.provider</requirement>
>>>
>>> <requirement>osgiliath.datasource.provider</requirement>
>>>
>>>
>>> <bundle>file:${project.root.basedir}/net.osgiliath.feature.itest.jpa/target/net.osgiliath.feature.itest.jpa-${project.version}.jar</bundle>
>>>
>>> </feature>
>>>
>>> <featurename='osgiliath-itests-jpa'version='${project.version}'>
>>>
>>> <feature version='${project.version}'>osgiliath-itests-db</feature>
>>>
>>> <featureversion='${project.version}'>osgiliath-derby</feature>
>>>
>>> <feature version='${project.version}'>osgiliath-itests-jpa-jar</feature>
>>>
>>> <featureversion='${project.version}'>osgiliath-jpa</feature>
>>>
>>> </feature>
>>>
>>>
>>> It does not avoid the tested module to fail (NPE when referencing the
>>> jndi datasource in the persistence.xml).
>>>
>>>
>>> I'll continue to investigate :).
>>>
>>>
>>> Best regards,
>>>
>>>
>>> 2015-07-05 17:45 GMT+02:00 Jean-Baptiste Onofré <jb@nanthrax.net
>>> <ma...@nanthrax.net>>:
>>>
>>>
>>>     Hi Charlie,
>>>
>>>     if you mean boot features, you can use stage with ( ... ).
>>>
>>>     For "regular" features, you have to use features requirement.
>>>
>>>     If your features uses xmlns 1.3.0, you can add a requirement to the
>>>     datasource service, and then the other feature can require the
>>>     datasource service.
>>>
>>>     Regards
>>>     JB
>>>
>>>
>>>     On 07/05/2015 05:26 PM, Charlie Mordant wrote:
>>>
>>>         Hi Karaf experts!
>>>
>>>         Is there a way to force feature ordering in K4? It was obvious
>>>         with K3,
>>>         but I didn't succeed to mimic it. I tried requirement/capability
>>> or
>>>         prerequisite="true", but it does not seem to work.
>>>
>>>         Here's the concrete use case:
>>>
>>>         I must have <pax-jdbc-config> + <myDsDriver> installed first,
>>> then a
>>>         config file (the <datasource-definition>), then the openjpa JPA
>>>         feature
>>>         and finally my integration test.
>>>
>>>
>>>         I tried something like this without success (in pseudo xml):
>>>
>>>         <feature "myItest">
>>>         <feature "myDs"/>
>>>         <feature "openjpa"/>
>>>         <bundle "myTestJar"/>
>>>         </feature>
>>>
>>>         <feature "myDs">
>>>         <feature "myDsDriver"/>
>>>         <config "myDsConfig"/>
>>>         </feature>
>>>
>>>         <feature "myDsDriver">
>>>         <bundle "derby"/>
>>>         <feature "pax-jdbc-config"/>
>>>         </feature>
>>>
>>>
>>>
>>>         Regards,
>>>         ​Charlie​
>>>
>>>         --
>>>         Charlie Mordant
>>>
>>>         Full OSGI/EE stack made with Karaf:
>>>         https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>>>
>>>
>>>     --
>>>     Jean-Baptiste Onofré
>>>     jbonofre@apache.org <ma...@apache.org>
>>>     http://blog.nanthrax.net
>>>     Talend - http://www.talend.com
>>>
>>>
>>>
>>>
>>> --
>>> Charlie Mordant
>>>
>>> Full OSGI/EE stack made with Karaf:
>>> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>
>
>
> --
> Charlie Mordant
>
> Full OSGI/EE stack made with Karaf:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>



-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Re: Karaf 4: feature ordering

Posted by Charlie Mordant <cm...@gmail.com>.
Hi JB,



Sure!
In fact I have <cap>db.provider</cap> feature (the pax-jdbc-config one),
and a <req>db.provider</req> and <cap>datasource.provider</cap> one
(containing a config property file).


I also tweaked the openjpa one to provide an osgiliath.persistence.provider
(even if it's useless).

Regards,


2015-07-05 20:51 GMT+02:00 Jean-Baptiste Onofré <jb...@nanthrax.net>:

> Hi Charlie,
>
> in osgiliath-itests-jpa-jar feature, you added:
>
> <requirement>osgiliath.datasource.provider</requirement>
>
> Do you have a feature providing:
>
> <capability>osgiliath.datasource.provider</capability>
>
> Else the resolver won't work a feature matching the requirement.
>
> Regards
> JB
>
> On 07/05/2015 08:44 PM, Charlie Mordant wrote:
>
>> Hi Jean-Baptiste,
>>
>> Kinda strange, I'm already doing it:
>>
>> <featurename='osgiliath-itests-jpa-jar'version='${project.version}'>
>>
>> <requirement>osgiliath.persistence.provider</requirement>
>>
>> <requirement>osgiliath.datasource.provider</requirement>
>>
>>
>> <bundle>file:${project.root.basedir}/net.osgiliath.feature.itest.jpa/target/net.osgiliath.feature.itest.jpa-${project.version}.jar</bundle>
>>
>> </feature>
>>
>> <featurename='osgiliath-itests-jpa'version='${project.version}'>
>>
>> <feature version='${project.version}'>osgiliath-itests-db</feature>
>>
>> <featureversion='${project.version}'>osgiliath-derby</feature>
>>
>> <feature version='${project.version}'>osgiliath-itests-jpa-jar</feature>
>>
>> <featureversion='${project.version}'>osgiliath-jpa</feature>
>>
>> </feature>
>>
>>
>> It does not avoid the tested module to fail (NPE when referencing the
>> jndi datasource in the persistence.xml).
>>
>>
>> I'll continue to investigate :).
>>
>>
>> Best regards,
>>
>>
>> 2015-07-05 17:45 GMT+02:00 Jean-Baptiste Onofré <jb@nanthrax.net
>> <ma...@nanthrax.net>>:
>>
>>
>>     Hi Charlie,
>>
>>     if you mean boot features, you can use stage with ( ... ).
>>
>>     For "regular" features, you have to use features requirement.
>>
>>     If your features uses xmlns 1.3.0, you can add a requirement to the
>>     datasource service, and then the other feature can require the
>>     datasource service.
>>
>>     Regards
>>     JB
>>
>>
>>     On 07/05/2015 05:26 PM, Charlie Mordant wrote:
>>
>>         Hi Karaf experts!
>>
>>         Is there a way to force feature ordering in K4? It was obvious
>>         with K3,
>>         but I didn't succeed to mimic it. I tried requirement/capability
>> or
>>         prerequisite="true", but it does not seem to work.
>>
>>         Here's the concrete use case:
>>
>>         I must have <pax-jdbc-config> + <myDsDriver> installed first,
>> then a
>>         config file (the <datasource-definition>), then the openjpa JPA
>>         feature
>>         and finally my integration test.
>>
>>
>>         I tried something like this without success (in pseudo xml):
>>
>>         <feature "myItest">
>>         <feature "myDs"/>
>>         <feature "openjpa"/>
>>         <bundle "myTestJar"/>
>>         </feature>
>>
>>         <feature "myDs">
>>         <feature "myDsDriver"/>
>>         <config "myDsConfig"/>
>>         </feature>
>>
>>         <feature "myDsDriver">
>>         <bundle "derby"/>
>>         <feature "pax-jdbc-config"/>
>>         </feature>
>>
>>
>>
>>         Regards,
>>         ​Charlie​
>>
>>         --
>>         Charlie Mordant
>>
>>         Full OSGI/EE stack made with Karaf:
>>         https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>>
>>
>>     --
>>     Jean-Baptiste Onofré
>>     jbonofre@apache.org <ma...@apache.org>
>>     http://blog.nanthrax.net
>>     Talend - http://www.talend.com
>>
>>
>>
>>
>> --
>> Charlie Mordant
>>
>> Full OSGI/EE stack made with Karaf:
>> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>



-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Re: Karaf 4: feature ordering

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Charlie,

in osgiliath-itests-jpa-jar feature, you added:

<requirement>osgiliath.datasource.provider</requirement>

Do you have a feature providing:

<capability>osgiliath.datasource.provider</capability>

Else the resolver won't work a feature matching the requirement.

Regards
JB

On 07/05/2015 08:44 PM, Charlie Mordant wrote:
> Hi Jean-Baptiste,
>
> Kinda strange, I'm already doing it:
>
> <featurename='osgiliath-itests-jpa-jar'version='${project.version}'>
>
> <requirement>osgiliath.persistence.provider</requirement>
>
> <requirement>osgiliath.datasource.provider</requirement>
>
> <bundle>file:${project.root.basedir}/net.osgiliath.feature.itest.jpa/target/net.osgiliath.feature.itest.jpa-${project.version}.jar</bundle>
>
> </feature>
>
> <featurename='osgiliath-itests-jpa'version='${project.version}'>
>
> <feature version='${project.version}'>osgiliath-itests-db</feature>
>
> <featureversion='${project.version}'>osgiliath-derby</feature>
>
> <feature version='${project.version}'>osgiliath-itests-jpa-jar</feature>
>
> <featureversion='${project.version}'>osgiliath-jpa</feature>
>
> </feature>
>
>
> It does not avoid the tested module to fail (NPE when referencing the
> jndi datasource in the persistence.xml).
>
>
> I'll continue to investigate :).
>
>
> Best regards,
>
>
> 2015-07-05 17:45 GMT+02:00 Jean-Baptiste Onofré <jb@nanthrax.net
> <ma...@nanthrax.net>>:
>
>     Hi Charlie,
>
>     if you mean boot features, you can use stage with ( ... ).
>
>     For "regular" features, you have to use features requirement.
>
>     If your features uses xmlns 1.3.0, you can add a requirement to the
>     datasource service, and then the other feature can require the
>     datasource service.
>
>     Regards
>     JB
>
>
>     On 07/05/2015 05:26 PM, Charlie Mordant wrote:
>
>         Hi Karaf experts!
>
>         Is there a way to force feature ordering in K4? It was obvious
>         with K3,
>         but I didn't succeed to mimic it. I tried requirement/capability or
>         prerequisite="true", but it does not seem to work.
>
>         Here's the concrete use case:
>
>         I must have <pax-jdbc-config> + <myDsDriver> installed first, then a
>         config file (the <datasource-definition>), then the openjpa JPA
>         feature
>         and finally my integration test.
>
>
>         I tried something like this without success (in pseudo xml):
>
>         <feature "myItest">
>         <feature "myDs"/>
>         <feature "openjpa"/>
>         <bundle "myTestJar"/>
>         </feature>
>
>         <feature "myDs">
>         <feature "myDsDriver"/>
>         <config "myDsConfig"/>
>         </feature>
>
>         <feature "myDsDriver">
>         <bundle "derby"/>
>         <feature "pax-jdbc-config"/>
>         </feature>
>
>
>
>         Regards,
>         ​Charlie​
>
>         --
>         Charlie Mordant
>
>         Full OSGI/EE stack made with Karaf:
>         https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>
>
>     --
>     Jean-Baptiste Onofré
>     jbonofre@apache.org <ma...@apache.org>
>     http://blog.nanthrax.net
>     Talend - http://www.talend.com
>
>
>
>
> --
> Charlie Mordant
>
> Full OSGI/EE stack made with Karaf:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent

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

Re: Karaf 4: feature ordering

Posted by Charlie Mordant <cm...@gmail.com>.
Hi Jean-Baptiste,

Kinda strange, I'm already doing it:

<feature name='osgiliath-itests-jpa-jar' version='${project.version}'>

 <requirement>osgiliath.persistence.provider</requirement>

 <requirement>osgiliath.datasource.provider</requirement>

 <bundle>
file:${project.root.basedir}/net.osgiliath.feature.itest.jpa/target/net.osgiliath.feature.itest.jpa-${project.version}.jar
</bundle>

</feature>

<feature name='osgiliath-itests-jpa' version='${project.version}'>

 <feature version='${project.version}'>osgiliath-itests-db</feature>

 <feature version='${project.version}'>osgiliath-derby</feature>

 <feature version='${project.version}'>osgiliath-itests-jpa-jar</feature>

 <feature version='${project.version}'>osgiliath-jpa</feature>

</feature>


It does not avoid the tested module to fail (NPE when referencing the jndi
datasource in the persistence.xml).


I'll continue to investigate :).


Best regards,

2015-07-05 17:45 GMT+02:00 Jean-Baptiste Onofré <jb...@nanthrax.net>:

> Hi Charlie,
>
> if you mean boot features, you can use stage with ( ... ).
>
> For "regular" features, you have to use features requirement.
>
> If your features uses xmlns 1.3.0, you can add a requirement to the
> datasource service, and then the other feature can require the datasource
> service.
>
> Regards
> JB
>
>
> On 07/05/2015 05:26 PM, Charlie Mordant wrote:
>
>> Hi Karaf experts!
>>
>> Is there a way to force feature ordering in K4? It was obvious with K3,
>> but I didn't succeed to mimic it. I tried requirement/capability or
>> prerequisite="true", but it does not seem to work.
>>
>> Here's the concrete use case:
>>
>> I must have <pax-jdbc-config> + <myDsDriver> installed first, then a
>> config file (the <datasource-definition>), then the openjpa JPA feature
>> and finally my integration test.
>>
>>
>> I tried something like this without success (in pseudo xml):
>>
>> <feature "myItest">
>> <feature "myDs"/>
>> <feature "openjpa"/>
>> <bundle "myTestJar"/>
>> </feature>
>>
>> <feature "myDs">
>> <feature "myDsDriver"/>
>> <config "myDsConfig"/>
>> </feature>
>>
>> <feature "myDsDriver">
>> <bundle "derby"/>
>> <feature "pax-jdbc-config"/>
>> </feature>
>>
>>
>>
>> Regards,
>> ​Charlie​
>>
>> --
>> Charlie Mordant
>>
>> Full OSGI/EE stack made with Karaf:
>> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>



-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Re: Karaf 4: feature ordering

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Charlie,

if you mean boot features, you can use stage with ( ... ).

For "regular" features, you have to use features requirement.

If your features uses xmlns 1.3.0, you can add a requirement to the 
datasource service, and then the other feature can require the 
datasource service.

Regards
JB

On 07/05/2015 05:26 PM, Charlie Mordant wrote:
> Hi Karaf experts!
>
> Is there a way to force feature ordering in K4? It was obvious with K3,
> but I didn't succeed to mimic it. I tried requirement/capability or
> prerequisite="true", but it does not seem to work.
>
> Here's the concrete use case:
>
> I must have <pax-jdbc-config> + <myDsDriver> installed first, then a
> config file (the <datasource-definition>), then the openjpa JPA feature
> and finally my integration test.
>
>
> I tried something like this without success (in pseudo xml):
>
> <feature "myItest">
> <feature "myDs"/>
> <feature "openjpa"/>
> <bundle "myTestJar"/>
> </feature>
>
> <feature "myDs">
> <feature "myDsDriver"/>
> <config "myDsConfig"/>
> </feature>
>
> <feature "myDsDriver">
> <bundle "derby"/>
> <feature "pax-jdbc-config"/>
> </feature>
>
>
>
> Regards,
> ​Charlie​
>
> --
> Charlie Mordant
>
> Full OSGI/EE stack made with Karaf:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent

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