Re: Jetty dynamic redirection

2016-03-03 Thread conejo

I think I have the answer. The following data file can create a service that
allows you to add redirections. It can serve as a working basis.

http://www.osgi.org/xmlns/blueprint/v1.0.0;>









   
 
 






 




--
View this message in context: 
http://karaf.922171.n3.nabble.com/Jetty-dynamic-redirection-tp4045668p4045679.html
Sent from the Karaf - User mailing list archive at Nabble.com.


Re: Dynamic Config Loading in Camel Application Bundle in Karaf 3.0.5

2016-03-03 Thread Debraj Manna
Thanks. This is what I was looking for.

On Thu, Mar 3, 2016 at 11:41 PM, Łukasz Dywicki  wrote:

>
> Hey Debraj,
> If you would like to reload just your bean add  pid=„wf” update-strategy="component-managed" update-method="methodToCall" />
> element inside „configBean” definition. Each update will result in calling
> given method. I don’t remember if it will set properties first. Other
> strategy which you could try is container-managed. For sure both will
> behave as managed service proxy.
>
> Best regards,
> Łukasz
> —
> l...@code-house.org
> Twitter: ldywicki
> Blog: http://dywicki.pl
> Code-House - http://code-house.org
>
>
>
> Wiadomość napisana przez Debraj Manna  w dniu 2
> mar 2016, o godz. 12:50:
>
>
> I have a simple Camel Application bundle which is to be deployed in Karaf
> 3.0.5 under Apache Service Mix 6.1. The configuration file is placed in
> etc/ directory (let's say it is named as wf.cfg). I want to have the
> dynamic config change functionality in my application bundle. So that
> whenever something is changed in wf.cfg it is immediately available to
> bundle. For this I have added the following in my blueprint.xml
>
>  update-strategy="reload">
> 
> 
> 
> 
>
> 
>  class="com.jabong.orchestratorservice.basecomponent.config.ConfigBean">
> 
> 
>
>
> The problem I am facing now is if the update-strategy is set to reload.
> Then it seems to be reloading the entire bean.
>
> Can someone let me know is there a way I can reload only the configBean
> not the entire bundle? If I can achieve this then may be I can have some
> static reference to the config variables inside the configBean which my
> application bundle can then make use of?
>
> The full blueprint.xml is placed here
> .
>
>
>
>
>
>


Is configuration via fileinstall fundamentally incompatible with webconsole?

2016-03-03 Thread Aaron Birkland
Hello,

I've noticed that configuration created/modified via fileinstall (i.e. files
in 'etc' or 'deploy') seems to conflict with configuration created/modified
via the webconsole in Karaf 4.0.4.   In particular, settings modified via
the webconsole behave fine at runtime, but are overwritten upon restart _in
cases where that configuration originated from fileinstall_.  Right now,
we're telling our users "never mix the two", but it seems like this may be a
bug.  I just wanted to ask the community what the expected behavior should
be, and whether I should file a bug report.

Here are two easily reproducible scenarios.  I've used Karaf 4.0.4 on both
Linux and Windows:

Scenario 1: Overwriting webconsole config
1) Launch an instance of Karaf
2) Install the webconsole (feature:install webconsole)
3) Navigate to OSGi->configuration.  Find "Apache Karaf Log" and open the
edit window
4) Make a trivial change: change "size" to 501 and save
5) Go back in to the edit window to confirm that 501 is still present
6) Stop and start Karaf
7) Navigate to OSGi->configuration.  Find "Apache Karaf Log" and open the
edit window
8) Notice that the original value of '500' is present rather than your
edited value of 501!

Scenario 2:  Unintended factory configuration consequences
1) Launch an instance of Karaf.  
2) Install the webconsole (feature:install webconsole)
3) Navigate to OSGi->configuration.  Find the org.apache.felix.fileinstall
instance and open the edit window
4) Make a trivial change, change poll interval to '1001' and save
5) Look at the list of services. Everything looks fine; there is one
fileinstall instance, and it contains your edits
6) Stop and start Karaf
7) Navigate to OSGi->configuration.  Look for org.apache.felix.fileinstall
8) Notice that there are now TWO instances running; one with the original
config (1000), and one with your edited poll value (1001)!

Digging into this, it looks like all configuration via webconsole is saved
under ./data/cache - even if the configuration originated from ./etc.  Upon
re-start, configuration from ./etc and ./data/cache seem to separately
loaded.  Wherever they conflict, if neither is a factory configuration then
*one* of them wins.  It seems to always be ./etc, but it is unclear if that
is deterministic.  For factory configurations, configurations from *both*
places end up instantiating a service instance. 

Please let me know what *should* happen in either scenario, and if there are
any workarounds.   

Thanks,

  -Aaron



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Is-configuration-via-fileinstall-fundamentally-incompatible-with-webconsole-tp4045677.html
Sent from the Karaf - User mailing list archive at Nabble.com.


Karaf shutdown management

2016-03-03 Thread Benson Margulies
I would like it to be so that when someone runs 'stop', some work in
progress finishes.

This would seem to require the @Deactivates to run in 'the right
order'. Presumably, the order is based on the graph of dependencies.

I'm thinking that I should create my own shutdown service and invoke
it before doing the actual Karaf shutdown.


Re: Problem with sevices using karaf 4.0.4 and cxf 3.1.4

2016-03-03 Thread Benson Margulies
I'm in production with 4.0.4 + CXF 3.1.4. I don't use blueprint, I
call the CXF API to publish my services.


On Thu, Mar 3, 2016 at 1:48 PM, Leandro Andrade  wrote:
> Do somebody know something about it?
>
> 2016-02-29 17:12 GMT-03:00 Leandro Andrade :
>>
>> Hi again,
>>
>> I used karaf 3.0.5 + cxf 3.1.4 and work well. Have some problem with karaf
>> 4 with cxf?
>>
>> Thanks a lot.
>>
>> Regards,
>>
>> 2016-02-29 16:51 GMT-03:00 Leandro Andrade :
>>>
>>> In time I installed a bundle with a jaxrs example in console:
>>>
>>> examples-cxf-jaxrs
>>>
>>> But I can't see in cxf service list.
>>>
>>>
>>>
>>> 2016-02-29 16:50 GMT-03:00 Leandro Andrade :

 Hi,

 I have some problem with services (jax-rs) using cxf 3.1.4 + karaf
 4.0.4. I installed a example service (extracted of package servicemix 7) as
 a bundle in karaf. It was started without errors, but I can't see this
 service in http://localhost:8181/cxf.


 --
 Leandro Andrade

>>>
>>>
>>>
>>> --
>>> Leandro Andrade
>>> http://www.leandroandrade.net
>>
>>
>>
>>
>> --
>> Leandro Andrade
>> http://www.leandroandrade.net
>
>
>
>
> --
> Leandro Andrade
> http://www.leandroandrade.net


Re: Problem with sevices using karaf 4.0.4 and cxf 3.1.4

2016-03-03 Thread Leandro Andrade
Do somebody know something about it?

2016-02-29 17:12 GMT-03:00 Leandro Andrade :

> Hi again,
>
> I used karaf 3.0.5 + cxf 3.1.4 and work well. Have some problem with karaf
> 4 with cxf?
>
> Thanks a lot.
>
> Regards,
>
> 2016-02-29 16:51 GMT-03:00 Leandro Andrade :
>
>> In time I installed a bundle with a jaxrs example in console:
>>
>> examples-cxf-jaxrs
>>
>> But I can't see in cxf service list.
>>
>>
>>
>> 2016-02-29 16:50 GMT-03:00 Leandro Andrade :
>>
>>> Hi,
>>>
>>> I have some problem with services (jax-rs) using cxf 3.1.4 + karaf
>>> 4.0.4. I installed a example service (extracted of package servicemix 7) as
>>> a bundle in karaf. It was started without errors, but I can't see this
>>> service in http://localhost:8181/cxf.
>>>
>>>
>>> --
>>> Leandro Andrade
>>>
>>>
>>
>>
>> --
>> Leandro Andrade
>> http://www.leandroandrade.net
>>
>
>
>
> --
> Leandro Andrade
> http://www.leandroandrade.net
>



-- 
Leandro Andrade
http://www.leandroandrade.net


Re: Dynamic Config Loading in Camel Application Bundle in Karaf 3.0.5

2016-03-03 Thread Łukasz Dywicki

Hey Debraj,
If you would like to reload just your bean add  element 
inside „configBean” definition. Each update will result in calling given 
method. I don’t remember if it will set properties first. Other strategy which 
you could try is container-managed. For sure both will behave as managed 
service proxy.

Best regards,
Łukasz
—
l...@code-house.org
Twitter: ldywicki
Blog: http://dywicki.pl
Code-House - http://code-house.org



> Wiadomość napisana przez Debraj Manna  w dniu 2 mar 
> 2016, o godz. 12:50:
> 
> 
> I have a simple Camel Application bundle which is to be deployed in Karaf 
> 3.0.5 under Apache Service Mix 6.1. The configuration file is placed in etc/ 
> directory (let's say it is named as wf.cfg). I want to have the dynamic 
> config change functionality in my application bundle. So that whenever 
> something is changed in wf.cfg it is immediately available to bundle. For 
> this I have added the following in my blueprint.xml
> 
>  update-strategy="reload">
> 
> 
> 
> 
> 
> 
>  class="com.jabong.orchestratorservice.basecomponent.config.ConfigBean">
> 
> 
> 
> 
> The problem I am facing now is if the update-strategy is set to reload. Then 
> it seems to be reloading the entire bean.
> 
> Can someone let me know is there a way I can reload only the configBean not 
> the entire bundle? If I can achieve this then may be I can have some static 
> reference to the config variables inside the configBean which my application 
> bundle can then make use of?
> 
> The full blueprint.xml is placed here 
> .
> 
> 
> 
> 
> 
> 
> 



RE: Dynamic Config Loading in Camel Application Bundle in Karaf 3.0.5

2016-03-03 Thread CLEMENT Jean-Philippe
I'm not too sure whether this is the right place/thread to discuss about DS vs 
Blueprint, but IMHO DS offers less possibilities than Blueprint.

Anyway, as far as I know you can't. But you may deal with the 
ConfigurationAdmin, BundleContext and ManagedService. I've wrapped all this to 
make it easy (and to rely as less as possible on OSGi specific API) with a 
couple of beans and a whiteboard interface to deal with config updates. Now 
it's handy in Blueprint and it deals with config updates without restarting 
anything :)

I guess you have to do the same. Good luck,
JP

De : David Jencks [mailto:david_jen...@yahoo.com]
Envoyé : mercredi 2 mars 2016 18:20
À : user@karaf.apache.org
Objet : Re: Dynamic Config Loading in Camel Application Bundle in Karaf 3.0.5

It would be a big change, but you might consider switching your application to 
use declarative services rather than  blueprint.  IMO blueprint is sort of 
spring shoehorned to sort of vaguely work a little bit in OSGI whereas DS is 
actually designed from the start to take full advantage of osgi.

david jencks

On Mar 2, 2016, at 3:50 AM, Debraj Manna 
> wrote:


I have a simple Camel Application bundle which is to be deployed in Karaf 3.0.5 
under Apache Service Mix 6.1. The configuration file is placed in etc/ 
directory (let's say it is named as wf.cfg). I want to have the dynamic config 
change functionality in my application bundle. So that whenever something is 
changed in wf.cfg it is immediately available to bundle. For this I have added 
the following in my blueprint.xml





















The problem I am facing now is if the update-strategy is set to reload. Then it 
seems to be reloading the entire bean.
Can someone let me know is there a way I can reload only the configBean not the 
entire bundle? If I can achieve this then may be I can have some static 
reference to the config variables inside the configBean which my application 
bundle can then make use of?
The full blueprint.xml is placed 
here.






RE: PAX-WEB ServletMapping service sometimes starts before ServletContextListenerMapping

2016-03-03 Thread CLEMENT Jean-Philippe
May you share your Blueprint file(s)?

JP

-Message d'origine-
De : kuvalda [mailto:peha...@mail.ru] 
Envoyé : mercredi 2 mars 2016 21:56
À : user@karaf.apache.org
Objet : RE: PAX-WEB ServletMapping service sometimes starts before 
ServletContextListenerMapping

Hi JP and Achim

Thanks for your advice.
Unfortunately, it didn't help.
I've tried to put depends-on="listenerMapping" to ServletMapping service.
Just in case, tried to put depends-on to DefaultServletMapping bean and Servlet 
bean.

Also I've tried to register just a Listener service itself without 
ListenerMapping.
It didn't help too.

They start in random order, so when serlvet starts before listener, 
contextInitialized event isn't caught.


Pavel


CLEMENT Jean-Philippe wrote
> Hi,
> 
> Did you try to put a "depends-on" in your Blueprint service?
> 
> JP





-
Pavel
--
View this message in context: 
http://karaf.922171.n3.nabble.com/PAX-WEB-ServletMapping-service-sometimes-starts-before-ServletContextListenerMapping-tp4045660p4045667.html
Sent from the Karaf - User mailing list archive at Nabble.com.