Re: Syncope + Camel + Spring problem

2016-09-21 Thread Colm O hEigeartaigh
Great, thanks!

Colm.

On Wed, Sep 21, 2016 at 10:59 AM, Francesco Chicchiriccò <
ilgro...@apache.org> wrote:

> On 21/09/2016 11:57, Colm O hEigeartaigh wrote:
>
>> Yep that works thanks! How is camelRoutesContext being picked up?
>>
>
> This is the reason - no Java code modification is needed:
>
> https://github.com/apache/syncope/blob/2_0_X/fit/core-refere
> nce/src/main/webapp/WEB-INF/web.xml#L28-L33
>
> Regards.
>
> On Tue, Sep 20, 2016 at 5:44 PM, Francesco Chicchiriccò <
>> ilgro...@apache.org> wrote:
>>
>> Il 20 settembre 2016 17:36:08 CEST, Colm O hEigeartaigh <
>>> cohei...@apache.org> ha scritto:
>>>
 On Tue, Sep 20, 2016 at 4:02 PM, Francesco Chicchiriccò<
 ilgro...@apache.org> wrote:

 You could do:
>
>  ApplicationContext appContext = new
> ClassPathXmlApplicationContext(
>  new String[]{"camel-beans.xml"},
> ApplicationContextProvider.getApplicationContext());
>  camelContext = new SpringCamelContext(appContext);
>
>
> e.g. setting the standard Syncope context as parent context.
>
> Yes this works fine to a point. The Camel component that I am calling
 seems
 to be picking up the bean definition from the configuration file +
 working
 correctly. However, I am getting a NPE subsequently in the Camel
 Producers
 in Syncope, caused by the fact that the Syncope PropagationManager in
 PropagateComponent (which is @Autowired) is null. Does this ring any
 bells?

>>> Hum, not really: you can alternatively leave the Java code as is, name
>>> your file camelRoutesContext.xml and place it in the classpath. It should
>>> work.
>>>
>>> Regards.
>>>
>>> It is not clear to me, however, how we could set up things to allow such
> (very useful, indeed) possibility.
>
> An empty "camel-beans.xml" file (maybe camelEnv.xml would better
> follow the naming in use) can be added under
>
> fit/core-reference/src/main/resources/all/
>
> and the code above could load it only when found.
> In this way the standalone distribution will simply provide the file
> that anyone could start customizing, while for the Maven project the
> reference guide [1] should be updated.
>
> WDYT?
>
> Regards.
>
> [1] https://syncope.apache.org/docs/reference-guide.html#enable-
> the-a-href-apache-camel-provisioning-manager-apache-
> camel-provisioning-manager-a
>

> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
>
> Member at The Apache Software Foundation
> Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
> http://home.apache.org/~ilgrosso/
>
>


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com


Re: Syncope + Camel + Spring problem

2016-09-21 Thread Francesco Chicchiriccò

On 21/09/2016 11:57, Colm O hEigeartaigh wrote:

Yep that works thanks! How is camelRoutesContext being picked up?


This is the reason - no Java code modification is needed:

https://github.com/apache/syncope/blob/2_0_X/fit/core-reference/src/main/webapp/WEB-INF/web.xml#L28-L33

Regards.


On Tue, Sep 20, 2016 at 5:44 PM, Francesco Chicchiriccò  
wrote:


Il 20 settembre 2016 17:36:08 CEST, Colm O hEigeartaigh  
ha scritto:

On Tue, Sep 20, 2016 at 4:02 PM, Francesco Chicchiriccò 
wrote:


You could do:

 ApplicationContext appContext = new
ClassPathXmlApplicationContext(
 new String[]{"camel-beans.xml"},
ApplicationContextProvider.getApplicationContext());
 camelContext = new SpringCamelContext(appContext);


e.g. setting the standard Syncope context as parent context.


Yes this works fine to a point. The Camel component that I am calling
seems
to be picking up the bean definition from the configuration file +
working
correctly. However, I am getting a NPE subsequently in the Camel
Producers
in Syncope, caused by the fact that the Syncope PropagationManager in
PropagateComponent (which is @Autowired) is null. Does this ring any
bells?

Hum, not really: you can alternatively leave the Java code as is, name
your file camelRoutesContext.xml and place it in the classpath. It should
work.

Regards.


It is not clear to me, however, how we could set up things to allow such (very 
useful, indeed) possibility.

An empty "camel-beans.xml" file (maybe camelEnv.xml would better follow the 
naming in use) can be added under

fit/core-reference/src/main/resources/all/

and the code above could load it only when found.
In this way the standalone distribution will simply provide the file that 
anyone could start customizing, while for the Maven project the reference guide 
[1] should be updated.

WDYT?

Regards.

[1] https://syncope.apache.org/docs/reference-guide.html#enable-
the-a-href-apache-camel-provisioning-manager-apache-
camel-provisioning-manager-a


--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/



Re: Syncope + Camel + Spring problem

2016-09-21 Thread Colm O hEigeartaigh
Yep that works thanks! How is camelRoutesContext being picked up?

Colm.

On Tue, Sep 20, 2016 at 5:44 PM, Francesco Chicchiriccò  wrote:

> Il 20 settembre 2016 17:36:08 CEST, Colm O hEigeartaigh <
> cohei...@apache.org> ha scritto:
> >On Tue, Sep 20, 2016 at 4:02 PM, Francesco Chicchiriccò
> > >> wrote:
> >
> >
> >> You could do:
> >>
> >> ApplicationContext appContext = new
> >> ClassPathXmlApplicationContext(
> >> new String[]{"camel-beans.xml"},
> >> ApplicationContextProvider.getApplicationContext());
> >> camelContext = new SpringCamelContext(appContext);
> >>
> >>
> >> e.g. setting the standard Syncope context as parent context.
> >>
> >
> >Yes this works fine to a point. The Camel component that I am calling
> >seems
> >to be picking up the bean definition from the configuration file +
> >working
> >correctly. However, I am getting a NPE subsequently in the Camel
> >Producers
> >in Syncope, caused by the fact that the Syncope PropagationManager in
> >PropagateComponent (which is @Autowired) is null. Does this ring any
> >bells?
>
> Hum, not really: you can alternatively leave the Java code as is, name
> your file camelRoutesContext.xml and place it in the classpath. It should
> work.
>
> Regards.
>
> >> It is not clear to me, however, how we could set up things to allow
> >such
> >> (very useful, indeed) possibility.
> >>
> >> An empty "camel-beans.xml" file (maybe camelEnv.xml would better
> >follow
> >> the naming in use) can be added under
> >>
> >> fit/core-reference/src/main/resources/all/
> >>
> >> and the code above could load it only when found.
> >> In this way the standalone distribution will simply provide the file
> >that
> >> anyone could start customizing, while for the Maven project the
> >reference
> >> guide [1] should be updated.
> >>
> >> WDYT?
> >>
> >> Regards.
> >>
> >> [1] https://syncope.apache.org/docs/reference-guide.html#enable-
> >> the-a-href-apache-camel-provisioning-manager-apache-
> >> camel-provisioning-manager-a
>
> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
>
> Member at The Apache Software Foundation Syncope, Cocoon, Olingo, CXF,
> OpenJPA, PonyMail
> http://home.apache.org/~ilgrosso/
>



-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com


Re: Syncope + Camel + Spring problem

2016-09-20 Thread Francesco Chicchiriccò
Il 20 settembre 2016 17:36:08 CEST, Colm O hEigeartaigh  
ha scritto:
>On Tue, Sep 20, 2016 at 4:02 PM, Francesco Chicchiriccò
>> wrote:
>
>
>> You could do:
>>
>> ApplicationContext appContext = new
>> ClassPathXmlApplicationContext(
>> new String[]{"camel-beans.xml"},
>> ApplicationContextProvider.getApplicationContext());
>> camelContext = new SpringCamelContext(appContext);
>>
>>
>> e.g. setting the standard Syncope context as parent context.
>>
>
>Yes this works fine to a point. The Camel component that I am calling
>seems
>to be picking up the bean definition from the configuration file +
>working
>correctly. However, I am getting a NPE subsequently in the Camel
>Producers
>in Syncope, caused by the fact that the Syncope PropagationManager in
>PropagateComponent (which is @Autowired) is null. Does this ring any
>bells?

Hum, not really: you can alternatively leave the Java code as is, name your 
file camelRoutesContext.xml and place it in the classpath. It should work.

Regards.

>> It is not clear to me, however, how we could set up things to allow
>such
>> (very useful, indeed) possibility.
>>
>> An empty "camel-beans.xml" file (maybe camelEnv.xml would better
>follow
>> the naming in use) can be added under
>>
>> fit/core-reference/src/main/resources/all/
>>
>> and the code above could load it only when found.
>> In this way the standalone distribution will simply provide the file
>that
>> anyone could start customizing, while for the Maven project the
>reference
>> guide [1] should be updated.
>>
>> WDYT?
>>
>> Regards.
>>
>> [1] https://syncope.apache.org/docs/reference-guide.html#enable-
>> the-a-href-apache-camel-provisioning-manager-apache-
>> camel-provisioning-manager-a

-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation Syncope, Cocoon, Olingo, CXF, OpenJPA, 
PonyMail
http://home.apache.org/~ilgrosso/


Re: Syncope + Camel + Spring problem

2016-09-20 Thread Colm O hEigeartaigh
On Tue, Sep 20, 2016 at 4:02 PM, Francesco Chicchiriccò  wrote:


> You could do:
>
> ApplicationContext appContext = new
> ClassPathXmlApplicationContext(
> new String[]{"camel-beans.xml"},
> ApplicationContextProvider.getApplicationContext());
> camelContext = new SpringCamelContext(appContext);
>
>
> e.g. setting the standard Syncope context as parent context.
>

Yes this works fine to a point. The Camel component that I am calling seems
to be picking up the bean definition from the configuration file + working
correctly. However, I am getting a NPE subsequently in the Camel Producers
in Syncope, caused by the fact that the Syncope PropagationManager in
PropagateComponent (which is @Autowired) is null. Does this ring any bells?

Colm.


>
> It is not clear to me, however, how we could set up things to allow such
> (very useful, indeed) possibility.
>
> An empty "camel-beans.xml" file (maybe camelEnv.xml would better follow
> the naming in use) can be added under
>
> fit/core-reference/src/main/resources/all/
>
> and the code above could load it only when found.
> In this way the standalone distribution will simply provide the file that
> anyone could start customizing, while for the Maven project the reference
> guide [1] should be updated.
>
> WDYT?
>
> Regards.
>
> [1] https://syncope.apache.org/docs/reference-guide.html#enable-
> the-a-href-apache-camel-provisioning-manager-apache-
> camel-provisioning-manager-a
>
> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
>
> Member at The Apache Software Foundation
> Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
> http://home.apache.org/~ilgrosso/
>
>
>


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com


Re: Syncope + Camel + Spring problem

2016-09-20 Thread Francesco Chicchiriccò

On 20/09/2016 16:45, Colm O hEigeartaigh wrote:

Hi all,

I've run into a problem with the way we set Camel up in Syncope. The
use-case is when you want to modify one of the routes to use a Camel
component that requires a pre-defined bean in the Camel Registry. There is
no way to do this in the console as you can only edit the routes, and not
define beans that are referenced in the routes.

In the SyncopeCamelContext class, we obtain a SpringCamelContext instance
via:

new SpringCamelContext(ApplicationContextProvider.getApplicationContext());

where ApplicationContextProvider is in the syncope-core-spring module. I
had in mind something like the following:

ApplicationContext appContext =
 new ClassPathXmlApplicationContext("camel-beans.xml");
camelContext = new SpringCamelContext(appContext);

So the user could just add whatever beans are required in camel-beans.xml
at deployment time, and they would be available to the routes. This doesn't
work however, as the routes complain that they can't find the uwfAdapter
bean.

Any thoughts on how this could work?


You could do:

ApplicationContext appContext = new 
ClassPathXmlApplicationContext(
new String[]{"camel-beans.xml"}, 
ApplicationContextProvider.getApplicationContext());

camelContext = new SpringCamelContext(appContext);


e.g. setting the standard Syncope context as parent context.

It is not clear to me, however, how we could set up things to allow such 
(very useful, indeed) possibility.


An empty "camel-beans.xml" file (maybe camelEnv.xml would better follow 
the naming in use) can be added under


fit/core-reference/src/main/resources/all/

and the code above could load it only when found.
In this way the standalone distribution will simply provide the file 
that anyone could start customizing, while for the Maven project the 
reference guide [1] should be updated.


WDYT?

Regards.

[1] 
https://syncope.apache.org/docs/reference-guide.html#enable-the-a-href-apache-camel-provisioning-manager-apache-camel-provisioning-manager-a


--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/




Syncope + Camel + Spring problem

2016-09-20 Thread Colm O hEigeartaigh
Hi all,

I've run into a problem with the way we set Camel up in Syncope. The
use-case is when you want to modify one of the routes to use a Camel
component that requires a pre-defined bean in the Camel Registry. There is
no way to do this in the console as you can only edit the routes, and not
define beans that are referenced in the routes.

In the SyncopeCamelContext class, we obtain a SpringCamelContext instance
via:

new SpringCamelContext(ApplicationContextProvider.getApplicationContext());

where ApplicationContextProvider is in the syncope-core-spring module. I
had in mind something like the following:

ApplicationContext appContext =
new ClassPathXmlApplicationContext("camel-beans.xml");
camelContext = new SpringCamelContext(appContext);

So the user could just add whatever beans are required in camel-beans.xml
at deployment time, and they would be available to the routes. This doesn't
work however, as the routes complain that they can't find the uwfAdapter
bean.

Any thoughts on how this could work?

Colm.


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com