Re: Feature, conditionally started based on a system capability

2016-02-01 Thread Sergiy Shyrkov

Hello JB,

thank you for the prompt reply!

You can to install the jahia-clustering feature only if  
org.jahia.cluster "property" is activated, right ?

Yes, that's right (like a feature-switch or enabler).

I've corrected the syntax for the requirement and it is taken into  
consideration on the first installation of the feature.
I guess, my approach in having a feature dynamically be stopped or started  
based on a value of a property is just a wrong direction :-)


Right now I am having a working solution where I am just having a feature  
in the featuresBoot, as:


featuresBoot = \
(bundle, \
config, \
deployer, \
...
system, \
wrap), \
jahia-core, \
jahia-jax-rs, \
${jahia.karaf.featuresBoot.extra}

And "jahia.karaf.featuresBoot.extra" system property is dynamically set by  
me (either to an empty string to to a "jahia-clustering").


For dynamically stopping/starting a feature on the property changes, I  
will do it manually in my code. Seems the right approach.


Thank you once again

Kind regards
Sergiy

On Fri, 29 Jan 2016 17:35:12 +0100, Jean-Baptiste Onofré   
wrote:



Hi Sergiy

You can to install the jahia-clustering feature only if  
org.jahia.cluster "property" is activated, right ?


Did you try:

org.jahia.cluster;filter:=("activated=true")

(you don't need & in the LDIF syntax as you have only one test)

and check if feature:requirement-list ?

Thanks,
Regards
JB

On 01/29/2016 05:22 PM, Sergiy Shyrkov wrote:

Hello,

I would need some help/advice on the following use case, please (I am
new to Karaf).

I would like to automatically have a feature be started, depending on
the availability of a system capability.
But I am not quite sure, I am taking a right approach.

My feature, is related to clustering in our product and should be
activated or not, based on a Java system property.

For now, I came up with the following system capability (which is
working so far):

org.osgi.framework.system.capabilities= \
...
  ${jahia-cluster-activated-${cluster.activated}}

jahia-cluster-activated-false = org.jahia.cluster; activated="false"

jahia-cluster-activated-true = org.jahia.cluster; activated="true"


And my feature is defined as follows (removing the unrelated stuff):

 
 cellar

org.jahia.cluster;filter:="((activated=true))"

 


And here where I am stuck :-)
If I add my feature to the boot feature list (featuresBoot in
org.apache.karaf.features.cfg) I am getting a failure on Karaf startup
in case my system property cluster.activate=false:

2016-01-29 17:20:08,894 | ERROR | pool-21-thread-1 |
BootFeaturesInstaller| 9 - org.apache.karaf.features.core -
4.0.4 | Error installing boot features
org.osgi.service.resolver.ResolutionException: Unable to resolve root:
missing requirement [root] osgi.identity;
osgi.identity=jahia-clustering; type=karaf.feature;
version="[7.2.0.0-SNAPSHOT,7.2.0.0-SNAPSHOT]";
filter:="(&(osgi.identity=jahia-clustering)(type=karaf.feature)(version>=7.2.0.0-SNAPSHOT)(version<=7.2.0.0-SNAPSHOT))"
[caused by: Unable to resolve jahia-clustering/7.2.0.0-SNAPSHOT: missing
requirement [jahia-clustering/7.2.0.0-SNAPSHOT] org.jahia.cluster;
filter:="(&(activated=true))"]
 at
org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)



And that prevents Karaf from starting.

I have a feeling that I am using not the right solution for my use case
and would really appreciate any inputs / hints.

Thanks in advance

Kind regards
Sergiy






--

Sergiy Shyrkov
Software Architect
jahia.com




Re: Feature, conditionally started based on a system capability

2016-01-29 Thread Jean-Baptiste Onofré

Hi Sergiy

You can to install the jahia-clustering feature only if 
org.jahia.cluster "property" is activated, right ?


Did you try:

org.jahia.cluster;filter:=("activated=true")

(you don't need & in the LDIF syntax as you have only one test)

and check if feature:requirement-list ?

Thanks,
Regards
JB

On 01/29/2016 05:22 PM, Sergiy Shyrkov wrote:

Hello,

I would need some help/advice on the following use case, please (I am
new to Karaf).

I would like to automatically have a feature be started, depending on
the availability of a system capability.
But I am not quite sure, I am taking a right approach.

My feature, is related to clustering in our product and should be
activated or not, based on a Java system property.

For now, I came up with the following system capability (which is
working so far):

org.osgi.framework.system.capabilities= \
...
  ${jahia-cluster-activated-${cluster.activated}}

jahia-cluster-activated-false = org.jahia.cluster; activated="false"

jahia-cluster-activated-true = org.jahia.cluster; activated="true"


And my feature is defined as follows (removing the unrelated stuff):

 
 cellar

org.jahia.cluster;filter:="((activated=true))"

 


And here where I am stuck :-)
If I add my feature to the boot feature list (featuresBoot in
org.apache.karaf.features.cfg) I am getting a failure on Karaf startup
in case my system property cluster.activate=false:

2016-01-29 17:20:08,894 | ERROR | pool-21-thread-1 |
BootFeaturesInstaller| 9 - org.apache.karaf.features.core -
4.0.4 | Error installing boot features
org.osgi.service.resolver.ResolutionException: Unable to resolve root:
missing requirement [root] osgi.identity;
osgi.identity=jahia-clustering; type=karaf.feature;
version="[7.2.0.0-SNAPSHOT,7.2.0.0-SNAPSHOT]";
filter:="(&(osgi.identity=jahia-clustering)(type=karaf.feature)(version>=7.2.0.0-SNAPSHOT)(version<=7.2.0.0-SNAPSHOT))"
[caused by: Unable to resolve jahia-clustering/7.2.0.0-SNAPSHOT: missing
requirement [jahia-clustering/7.2.0.0-SNAPSHOT] org.jahia.cluster;
filter:="(&(activated=true))"]
 at
org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)



And that prevents Karaf from starting.

I have a feeling that I am using not the right solution for my use case
and would really appreciate any inputs / hints.

Thanks in advance

Kind regards
Sergiy



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


Feature, conditionally started based on a system capability

2016-01-29 Thread Sergiy Shyrkov

Hello,

I would need some help/advice on the following use case, please (I am new  
to Karaf).


I would like to automatically have a feature be started, depending on the  
availability of a system capability.

But I am not quite sure, I am taking a right approach.

My feature, is related to clustering in our product and should be  
activated or not, based on a Java system property.


For now, I came up with the following system capability (which is working  
so far):


org.osgi.framework.system.capabilities= \
...
 ${jahia-cluster-activated-${cluster.activated}}

jahia-cluster-activated-false = org.jahia.cluster; activated="false"

jahia-cluster-activated-true = org.jahia.cluster; activated="true"


And my feature is defined as follows (removing the unrelated stuff):


cellar

org.jahia.cluster;filter:="((activated=true))"



And here where I am stuck :-)
If I add my feature to the boot feature list (featuresBoot in  
org.apache.karaf.features.cfg) I am getting a failure on Karaf startup in  
case my system property cluster.activate=false:


2016-01-29 17:20:08,894 | ERROR | pool-21-thread-1 |  
BootFeaturesInstaller| 9 - org.apache.karaf.features.core -  
4.0.4 | Error installing boot features
org.osgi.service.resolver.ResolutionException: Unable to resolve root:  
missing requirement [root] osgi.identity; osgi.identity=jahia-clustering;  
type=karaf.feature; version="[7.2.0.0-SNAPSHOT,7.2.0.0-SNAPSHOT]";  
filter:="(&(osgi.identity=jahia-clustering)(type=karaf.feature)(version>=7.2.0.0-SNAPSHOT)(version<=7.2.0.0-SNAPSHOT))"  
[caused by: Unable to resolve jahia-clustering/7.2.0.0-SNAPSHOT: missing  
requirement [jahia-clustering/7.2.0.0-SNAPSHOT] org.jahia.cluster;  
filter:="(&(activated=true))"]
	at  
org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)



And that prevents Karaf from starting.

I have a feeling that I am using not the right solution for my use case  
and would really appreciate any inputs / hints.


Thanks in advance

Kind regards
Sergiy

--

Sergiy Shyrkov
Software Architect
jahia.com