Features automatic vs manual install

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Features automatic vs manual install

afbagwe

I'm trying to write a features XML file that will be included in a KAR for deployment.

While my individual features are functional, when I perform the command:

kar:install file:/path/to/kar

everything gets loaded into Karaf, but all the features are automatically started. While this is fine for some core pieces there are several optional ones that I don't want installed by default as they would be a choice depending on the needs of the application.

How can I construct my features file to accomplish this?

I have already looked at the XSD for features and trying to use the install attribute on the feature tag, but setting it to either "false" or "manual" doesn't stop auto installation from occurring. The XSD says this attribute is a simple string with a minimum length of 1 character with no indication of what the possible values are.

Thanks,
Allen

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Features automatic vs manual install

jbonofre
Hi,

you have two ways to do that:

- on <feature/> you have the "install" attribute. It's "auto" by default,
however, you can use "manual". It should work.
- in a feature, on the <bundle/> you have the start attribute. You can control
if a bundle stays in resolved state or if it's automatically started.

Regards
JB

On 08/02/2017 05:43 PM, afbagwe wrote:

> I'm trying to write a features XML file that will be included in a KAR for
> deployment.
> While my individual features are functional, when I perform the command:
> kar:install file:/path/to/kar
> everything gets loaded into Karaf, but all the features are automatically
> started. While this is fine for some core pieces there are several optional
> ones that I don't want installed by default as they would be a choice
> depending on the needs of the application.
> How can I construct my features file to accomplish this?
> I have already looked at the XSD for features and trying to use the install
> attribute on the feature tag, but setting it to either "false" or "manual"
> doesn't stop auto installation from occurring. The XSD says this attribute
> is a simple string with a minimum length of 1 character with no indication
> of what the possible values are.
> Thanks,
> Allen
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Features-automatic-vs-manual-install-tp4051144.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Features automatic vs manual install

afbagwe
Yes, as I mentioned I have tried using the "install" attribute.

Here is one part of my features file:

<feature name="hazelcast" description="Hazelcast w/ Camel integration" install="manual" version="${project.version}">
      <feature prerequisite="true">transaction</feature>
      <feature version="${camel.version}">camel-core</feature>
      <bundle>mvn:com.eclipsesource.minimal-json/minimal-json/0.9.4</bundle>
      <bundle>mvn:org.apache.camel/camel-hazelcast/${camel.version}</bundle>
      <bundle>mvn:com.hazelcast/hazelcast/${hazelcast.version}</bundle>
</feature>


This feature and others like it start automatically when I install the KAR file and have a check in the "Required" column.

hazelcast                    │ 1.0.0.SNAPSHOT   │ x        │ Started     │ hazelcast-1.0.0-SNAPSHOT           │ Hazelcast w/ Camel integration

I'm using Karaf 4.1.1 along with the karaf Maven plugin (same version) to generate my kar.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Features automatic vs manual install

jbonofre
Let me try to reproduce.

Did you check that the features.xml inside the KAR is actually the same ?

Regards
JB

On 08/02/2017 06:33 PM, afbagwe wrote:

> Yes, as I mentioned I have tried using the "install" attribute.
>
> Here is one part of my features file:
>
> <feature name="hazelcast" description="Hazelcast w/ Camel integration"
> install="manual" version="${project.version}">
>        <feature prerequisite="true">transaction</feature>
>        <feature version="${camel.version}">camel-core</feature>
>        <bundle>mvn:com.eclipsesource.minimal-json/minimal-json/0.9.4</bundle>
>        <bundle>mvn:org.apache.camel/camel-hazelcast/${camel.version}</bundle>
>        <bundle>mvn:com.hazelcast/hazelcast/${hazelcast.version}</bundle>
> </feature>
>
>
> This feature and others like it start automatically when I install the KAR
> file and have a check in the "Required" column.
>
> hazelcast                    │ 1.0.0.SNAPSHOT   │ x        │ Started     │
> hazelcast-1.0.0-SNAPSHOT           │ Hazelcast w/ Camel integration
>
> I'm using Karaf 4.1.1 along with the karaf Maven plugin (same version) to
> generate my kar.
>
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Features-automatic-vs-manual-install-tp4051144p4051146.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Features automatic vs manual install

afbagwe
Yes. Here's the content of features.xml file inside the KAR...

<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="hazelcast-1.0.0-SNAPSHOT">
    <repository>mvn:org.apache.karaf.features/standard/4.1.1/xml/features</repository>
    <feature name="hazelcast" description="Hazelcast w/ Camel integration" install="manual" version="1.0.0.SNAPSHOT">
        <details>This feature set provides Hazelcast to be used independently or through Camel.</details>
        <feature prerequisite="false" dependency="false">transaction</feature>
        <feature version="2.18.3" prerequisite="false" dependency="true">camel-core</feature>
        <bundle>mvn:com.eclipsesource.minimal-json/minimal-json/0.9.4</bundle>
        <bundle>mvn:org.apache.camel/camel-hazelcast/2.18.3</bundle>
        <bundle>mvn:com.hazelcast/hazelcast/3.7.1</bundle>
    </feature>
</features>

Thanks for checking this!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Features automatic vs manual install

jbonofre
Thanks for the update.

As we had a regression on the <bundle/> "start" attribute, it's possible that we
have an issue on the <feature/> "install" attribute as well.

For the tracking, I created the following Jira:

https://issues.apache.org/jira/browse/KARAF-5285

By the way, as Cellar also provides a hazelcast feature, I would recommend to
name your feature differently (like camel-w-hazelcast for instance).

Regards
JB

On 08/02/2017 07:00 PM, afbagwe wrote:

> Yes. Here's the content of features.xml file inside the KAR...
>
> <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"
> name="hazelcast-1.0.0-SNAPSHOT">
>    
> <repository>mvn:org.apache.karaf.features/standard/4.1.1/xml/features</repository>
>      <feature name="hazelcast" description="Hazelcast w/ Camel integration"
> install="manual" version="1.0.0.SNAPSHOT">
>          <details>This feature set provides Hazelcast to be used
> independently or through Camel.</details>
>          <feature prerequisite="false"
> dependency="false">transaction</feature>
>          <feature version="2.18.3" prerequisite="false"
> dependency="true">camel-core</feature>
>        
> <bundle>mvn:com.eclipsesource.minimal-json/minimal-json/0.9.4</bundle>
>          <bundle>mvn:org.apache.camel/camel-hazelcast/2.18.3</bundle>
>          <bundle>mvn:com.hazelcast/hazelcast/3.7.1</bundle>
>      </feature>
> </features>
>
> Thanks for checking this!
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Features-automatic-vs-manual-install-tp4051144p4051148.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Features automatic vs manual install

afbagwe
Will rename, thanks. :)

Side question. I was not able to track down the difference between "dependency" and "prerequisite" boolean attributes on the feature tag. Or how the former differs from the same attribute on the bundle tag.

Can you provide an explanation or a link to such?

Thanks again!


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Features automatic vs manual install

jbonofre
I just tested on 4.1.2-SNAPSHOT and 4.2.0-SNAPSHOT:
- I created a features XML with a feature containing install="manual"
- I packaged this features XML as a kar
- I installed the kar installation via both deploy folder and kar:install command

The install attribute is correctly taking in account. In the log, I can even see:

2017-08-04 08:49:58,453 | WARN  | -SNAPSHOT/deploy | KarServiceImpl
      | 35 - org.apache.karaf.kar.core - 4.1.2.SNAPSHOT | Feature
test/1.0.0.SNAPSHOT has install flag set to "manual", so it's not automatically
installed

So, it works fine for me.

Regards
JB

On 08/02/2017 08:18 PM, afbagwe wrote:

> Will rename, thanks. :)
>
> Side question. I was not able to track down the difference between
> "dependency" and "prerequisite" boolean attributes on the feature tag. Or
> how the former differs from the same attribute on the bundle tag.
>
> Can you provide an explanation or a link to such?
>
> Thanks again!
>
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Features-automatic-vs-manual-install-tp4051144p4051150.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Loading...