You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Andrea Zoppello <zo...@tiscali.it> on 2008/02/22 11:52:38 UTC
Drools DbHelper in LHS of rule??
Hi all,
Actually i'm using a customized version of servicemix-drools for the
following reasons:
1) I need to use db helper objects both in LHS, and in RHS of my drl files.
2) I need to specify a defaultTargetService URI if no rule would be true.
At the moment i'm trying to apply the approach described here, to see if
it could feet my needs:
http://gnodet.blogspot.com/2007/06/accessing-databases-in-servicemix.html
but i found some problems:
1) the syntax described seems to be not correct, i don't know which is
the right value for
util namespace used.
2) With this approach Drools Db helper cannot be used on the LHS side of
the rules.
Any idea??
Until i don't resolve this i'm forced to mantain my own version that
simple assert a db helper
object in the working memory..
Andrea
Re: Drools DbHelper in LHS of rule??
Posted by Andrea Zoppello <zo...@tiscali.it>.
Just open SM-1248 with patch files.
Andrea
Guillaume Nodet ha scritto:
> On Fri, Feb 22, 2008 at 3:40 PM, Andrea Zoppello <zo...@tiscali.it> wrote:
>
>> Hi Guillaume,
>>
>> See my comments inline:
>>
>> Guillaume Nodet ha scritto:
>>
>>
>>> The main problem I had with your patch is that a QName for the target sevice
>>>
>> > may not always be sufficient. I was thinking about using a uri or something as
>> >
>>
>> Yes i agree with you, i've just discussed about that with other guys
>> from iona on spagic jira.
>>
>
> Any url ?
>
>
>> We agree the best solution could be to have an endpoint where you could
>> specify:
>> defaultTargetService *or* defaultTargetURI where defaultTargetURI have
>> the precedence on defaultTargetService.
>>
>
> Sounds good to me. It should be enough.
>
>
>>> in the eip component.
>>>
>> > <eip:exchange-target service="test:routingSlip" />
>> > See http://servicemix.apache.org/servicemix-eip.html#servicemix-eip-ExchangeTarget
>> >
>> > As for using the Db helper in the globals, look at this example:
>> > http://servicemix.apache.org/servicemix-drools.html#servicemix-drools-Injectingadditionalbeansintherules
>> > The util namespace is bound to the spring namespace:
>> >
>>
>> Just seen this, but notice that this example use the global jbi objetc
>> on RHS part of the rule non in LHS.
>>
>>
>>> http://static.springframework.org/spring/docs/2.0.x/reference/xsd-config.html#xsd-config-body-schemas-util
>>>
>> >
>> >
>> Thanks i was missing this point about spring.
>>
>>
>>> Btw, how did you assert this object in memory ? Is there something to
>>>
>> > do in the java code for that ?
>> >
>>
>> I've simply modified the component in
>> DroolsEndpoint.populateWorkingMemory i add this line:
>>
>> memory.assertObject(new DbHelper( ));
>>
>> that's all.
>>
>> Maybe a solution was to inject ( with spring ) not only the globals
>> object but also, the helper objects to be asserted in memory ( another
>> Map in DroolsEndpoint class ).
>>
>
> Sounds good. I don't think it needs to be a map but a simple list should
> be sufficient. Anyway, this sounds very generic and useful.
>
> I'm we will solve this problem. Will you provide another patch about those
> two problems ? You can also include the defaultRoute stuff from SM-888, as
> I don't have any concerns with that (provided that everything works as before).
>
>
>> Andrea
>>
>>
>>
>> > On Fri, Feb 22, 2008 at 1:41 PM, Andrea Zoppello <zo...@tiscali.it> wrote:
>> >
>> >> Hi Guillaume,
>> >>
>> >> It's not a *packaging problem*, my dbhelper objetct is in the classpath,
>> >> so in the drl file i'm
>> >> able to view it.
>> >>
>> >> The problem is that if i use the technique you describe ( to put the
>> >> dbhelper object ) in drools
>> >> global entry i'm not able to write rules like:
>> >>
>> >> rule "Rule1"
>> >> when
>> >> me : Exchange( status == Exchange.ACTIVE, in : in != null );
>> >> db : DbHelper ( );
>> >> eval( db.exist( in.valueOf("/ACTION/@name"), "STRING",
>> >> "attribute", "name", "metadb" ) );
>> >> then
>> >> jbi.fault( "<ERROR> The value is already present in db </ERROR>" );
>> >> end
>> >>
>> >> The only think i need is to use the dbhelper object in Left part of the
>> >> rule, and this seems to work very well if the dbhelper object is
>> >> asserted in memory, on the other side i'm not sure this is possible if
>> >> the object is in *global* area of working memory.
>> >>
>> >> I've just tried to have my helper as you describe, but i'm not able to
>> >> write a drools rule that use it in left side part.
>> >>
>> >> BTW could you pust a full xbean.xml for the example so i could see also
>> >> the namespace declaration for that part:
>> >>
>> >> <util:map id="globals">
>> >> <entry key="helper" value-ref="helper" />
>> >> </util:map>
>> >>
>> >>
>> >> BTW my diff are already here:
>> >>
>> >> https://issues.apache.org/activemq/browse/SM-888
>> >>
>> >> but it seem that were not accepted.
>> >>
>> >> Andrea
>> >>
>> >>
>> >>
>> >> Guillaume Nodet ha scritto:
>> >>
>> >>
>> >>
>> >>> Have you tried embedding your specific DbHelper in your SU instead of
>> >>>
>> >> > repackaging the component ? It may prove easier.
>> >> >
>> >> > Anyway, what does 1 lead to ? Did you had to change the DbHelper for that ?
>> >> > Maybe you can post a diff so that we can review and discuss it ?
>> >> >
>> >> > On Fri, Feb 22, 2008 at 11:52 AM, Andrea Zoppello <zo...@tiscali.it> wrote:
>> >> >
>> >> >> Hi all,
>> >> >>
>> >> >> Actually i'm using a customized version of servicemix-drools for the
>> >> >> following reasons:
>> >> >>
>> >> >> 1) I need to use db helper objects both in LHS, and in RHS of my drl files.
>> >> >>
>> >> >> 2) I need to specify a defaultTargetService URI if no rule would be true.
>> >> >>
>> >> >> At the moment i'm trying to apply the approach described here, to see if
>> >> >> it could feet my needs:
>> >> >>
>> >> >> http://gnodet.blogspot.com/2007/06/accessing-databases-in-servicemix.html
>> >> >>
>> >> >> but i found some problems:
>> >> >>
>> >> >> 1) the syntax described seems to be not correct, i don't know which is
>> >> >> the right value for
>> >> >> util namespace used.
>> >> >>
>> >> >> 2) With this approach Drools Db helper cannot be used on the LHS side of
>> >> >> the rules.
>> >> >>
>> >> >> Any idea??
>> >> >> Until i don't resolve this i'm forced to mantain my own version that
>> >> >> simple assert a db helper
>> >> >> object in the working memory..
>> >> >>
>> >> >> Andrea
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> >
>>
>>
>>
>
>
>
>
Re: Drools DbHelper in LHS of rule??
Posted by Andrea Zoppello <zo...@tiscali.it>.
Hi,
Here the discussion with ron about smx-888
http://forge.objectweb.org/forum/forum.php?thread_id=4243&forum_id=1230
BTW, at the moment i'm very busy to solve some cxf-bc stuff, in the next
day when
i'll be more free i'm going to provide a complete patch for:
1) default routing stuff supporting defaultTargetService, defaultTargetURI
2) assert a list of objects in working memory, I agree the asserted
object could be a list.
Regards
Andrea
Guillaume Nodet ha scritto:
> On Fri, Feb 22, 2008 at 3:40 PM, Andrea Zoppello <zo...@tiscali.it> wrote:
>
>> Hi Guillaume,
>>
>> See my comments inline:
>>
>> Guillaume Nodet ha scritto:
>>
>>
>>> The main problem I had with your patch is that a QName for the target sevice
>>>
>> > may not always be sufficient. I was thinking about using a uri or something as
>> >
>>
>> Yes i agree with you, i've just discussed about that with other guys
>> from iona on spagic jira.
>>
>
> Any url ?
>
>
>> We agree the best solution could be to have an endpoint where you could
>> specify:
>> defaultTargetService *or* defaultTargetURI where defaultTargetURI have
>> the precedence on defaultTargetService.
>>
>
> Sounds good to me. It should be enough.
>
>
>>> in the eip component.
>>>
>> > <eip:exchange-target service="test:routingSlip" />
>> > See http://servicemix.apache.org/servicemix-eip.html#servicemix-eip-ExchangeTarget
>> >
>> > As for using the Db helper in the globals, look at this example:
>> > http://servicemix.apache.org/servicemix-drools.html#servicemix-drools-Injectingadditionalbeansintherules
>> > The util namespace is bound to the spring namespace:
>> >
>>
>> Just seen this, but notice that this example use the global jbi objetc
>> on RHS part of the rule non in LHS.
>>
>>
>>> http://static.springframework.org/spring/docs/2.0.x/reference/xsd-config.html#xsd-config-body-schemas-util
>>>
>> >
>> >
>> Thanks i was missing this point about spring.
>>
>>
>>> Btw, how did you assert this object in memory ? Is there something to
>>>
>> > do in the java code for that ?
>> >
>>
>> I've simply modified the component in
>> DroolsEndpoint.populateWorkingMemory i add this line:
>>
>> memory.assertObject(new DbHelper( ));
>>
>> that's all.
>>
>> Maybe a solution was to inject ( with spring ) not only the globals
>> object but also, the helper objects to be asserted in memory ( another
>> Map in DroolsEndpoint class ).
>>
>
> Sounds good. I don't think it needs to be a map but a simple list should
> be sufficient. Anyway, this sounds very generic and useful.
>
> I'm we will solve this problem. Will you provide another patch about those
> two problems ? You can also include the defaultRoute stuff from SM-888, as
> I don't have any concerns with that (provided that everything works as before).
>
>
>> Andrea
>>
>>
>>
>> > On Fri, Feb 22, 2008 at 1:41 PM, Andrea Zoppello <zo...@tiscali.it> wrote:
>> >
>> >> Hi Guillaume,
>> >>
>> >> It's not a *packaging problem*, my dbhelper objetct is in the classpath,
>> >> so in the drl file i'm
>> >> able to view it.
>> >>
>> >> The problem is that if i use the technique you describe ( to put the
>> >> dbhelper object ) in drools
>> >> global entry i'm not able to write rules like:
>> >>
>> >> rule "Rule1"
>> >> when
>> >> me : Exchange( status == Exchange.ACTIVE, in : in != null );
>> >> db : DbHelper ( );
>> >> eval( db.exist( in.valueOf("/ACTION/@name"), "STRING",
>> >> "attribute", "name", "metadb" ) );
>> >> then
>> >> jbi.fault( "<ERROR> The value is already present in db </ERROR>" );
>> >> end
>> >>
>> >> The only think i need is to use the dbhelper object in Left part of the
>> >> rule, and this seems to work very well if the dbhelper object is
>> >> asserted in memory, on the other side i'm not sure this is possible if
>> >> the object is in *global* area of working memory.
>> >>
>> >> I've just tried to have my helper as you describe, but i'm not able to
>> >> write a drools rule that use it in left side part.
>> >>
>> >> BTW could you pust a full xbean.xml for the example so i could see also
>> >> the namespace declaration for that part:
>> >>
>> >> <util:map id="globals">
>> >> <entry key="helper" value-ref="helper" />
>> >> </util:map>
>> >>
>> >>
>> >> BTW my diff are already here:
>> >>
>> >> https://issues.apache.org/activemq/browse/SM-888
>> >>
>> >> but it seem that were not accepted.
>> >>
>> >> Andrea
>> >>
>> >>
>> >>
>> >> Guillaume Nodet ha scritto:
>> >>
>> >>
>> >>
>> >>> Have you tried embedding your specific DbHelper in your SU instead of
>> >>>
>> >> > repackaging the component ? It may prove easier.
>> >> >
>> >> > Anyway, what does 1 lead to ? Did you had to change the DbHelper for that ?
>> >> > Maybe you can post a diff so that we can review and discuss it ?
>> >> >
>> >> > On Fri, Feb 22, 2008 at 11:52 AM, Andrea Zoppello <zo...@tiscali.it> wrote:
>> >> >
>> >> >> Hi all,
>> >> >>
>> >> >> Actually i'm using a customized version of servicemix-drools for the
>> >> >> following reasons:
>> >> >>
>> >> >> 1) I need to use db helper objects both in LHS, and in RHS of my drl files.
>> >> >>
>> >> >> 2) I need to specify a defaultTargetService URI if no rule would be true.
>> >> >>
>> >> >> At the moment i'm trying to apply the approach described here, to see if
>> >> >> it could feet my needs:
>> >> >>
>> >> >> http://gnodet.blogspot.com/2007/06/accessing-databases-in-servicemix.html
>> >> >>
>> >> >> but i found some problems:
>> >> >>
>> >> >> 1) the syntax described seems to be not correct, i don't know which is
>> >> >> the right value for
>> >> >> util namespace used.
>> >> >>
>> >> >> 2) With this approach Drools Db helper cannot be used on the LHS side of
>> >> >> the rules.
>> >> >>
>> >> >> Any idea??
>> >> >> Until i don't resolve this i'm forced to mantain my own version that
>> >> >> simple assert a db helper
>> >> >> object in the working memory..
>> >> >>
>> >> >> Andrea
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> >
>>
>>
>>
>
>
>
>
Re: Drools DbHelper in LHS of rule??
Posted by Guillaume Nodet <gn...@gmail.com>.
On Fri, Feb 22, 2008 at 3:40 PM, Andrea Zoppello <zo...@tiscali.it> wrote:
> Hi Guillaume,
>
> See my comments inline:
>
> Guillaume Nodet ha scritto:
>
> > The main problem I had with your patch is that a QName for the target sevice
> > may not always be sufficient. I was thinking about using a uri or something as
> >
>
> Yes i agree with you, i've just discussed about that with other guys
> from iona on spagic jira.
Any url ?
>
> We agree the best solution could be to have an endpoint where you could
> specify:
> defaultTargetService *or* defaultTargetURI where defaultTargetURI have
> the precedence on defaultTargetService.
Sounds good to me. It should be enough.
>
> > in the eip component.
> > <eip:exchange-target service="test:routingSlip" />
> > See http://servicemix.apache.org/servicemix-eip.html#servicemix-eip-ExchangeTarget
> >
> > As for using the Db helper in the globals, look at this example:
> > http://servicemix.apache.org/servicemix-drools.html#servicemix-drools-Injectingadditionalbeansintherules
> > The util namespace is bound to the spring namespace:
> >
>
> Just seen this, but notice that this example use the global jbi objetc
> on RHS part of the rule non in LHS.
>
> > http://static.springframework.org/spring/docs/2.0.x/reference/xsd-config.html#xsd-config-body-schemas-util
> >
> >
> Thanks i was missing this point about spring.
>
> > Btw, how did you assert this object in memory ? Is there something to
> > do in the java code for that ?
> >
>
> I've simply modified the component in
> DroolsEndpoint.populateWorkingMemory i add this line:
>
> memory.assertObject(new DbHelper( ));
>
> that's all.
>
> Maybe a solution was to inject ( with spring ) not only the globals
> object but also, the helper objects to be asserted in memory ( another
> Map in DroolsEndpoint class ).
Sounds good. I don't think it needs to be a map but a simple list should
be sufficient. Anyway, this sounds very generic and useful.
I'm we will solve this problem. Will you provide another patch about those
two problems ? You can also include the defaultRoute stuff from SM-888, as
I don't have any concerns with that (provided that everything works as before).
>
> Andrea
>
>
>
> > On Fri, Feb 22, 2008 at 1:41 PM, Andrea Zoppello <zo...@tiscali.it> wrote:
> >
> >> Hi Guillaume,
> >>
> >> It's not a *packaging problem*, my dbhelper objetct is in the classpath,
> >> so in the drl file i'm
> >> able to view it.
> >>
> >> The problem is that if i use the technique you describe ( to put the
> >> dbhelper object ) in drools
> >> global entry i'm not able to write rules like:
> >>
> >> rule "Rule1"
> >> when
> >> me : Exchange( status == Exchange.ACTIVE, in : in != null );
> >> db : DbHelper ( );
> >> eval( db.exist( in.valueOf("/ACTION/@name"), "STRING",
> >> "attribute", "name", "metadb" ) );
> >> then
> >> jbi.fault( "<ERROR> The value is already present in db </ERROR>" );
> >> end
> >>
> >> The only think i need is to use the dbhelper object in Left part of the
> >> rule, and this seems to work very well if the dbhelper object is
> >> asserted in memory, on the other side i'm not sure this is possible if
> >> the object is in *global* area of working memory.
> >>
> >> I've just tried to have my helper as you describe, but i'm not able to
> >> write a drools rule that use it in left side part.
> >>
> >> BTW could you pust a full xbean.xml for the example so i could see also
> >> the namespace declaration for that part:
> >>
> >> <util:map id="globals">
> >> <entry key="helper" value-ref="helper" />
> >> </util:map>
> >>
> >>
> >> BTW my diff are already here:
> >>
> >> https://issues.apache.org/activemq/browse/SM-888
> >>
> >> but it seem that were not accepted.
> >>
> >> Andrea
> >>
> >>
> >>
> >> Guillaume Nodet ha scritto:
> >>
> >>
> >>
> >>> Have you tried embedding your specific DbHelper in your SU instead of
> >>>
> >> > repackaging the component ? It may prove easier.
> >> >
> >> > Anyway, what does 1 lead to ? Did you had to change the DbHelper for that ?
> >> > Maybe you can post a diff so that we can review and discuss it ?
> >> >
> >> > On Fri, Feb 22, 2008 at 11:52 AM, Andrea Zoppello <zo...@tiscali.it> wrote:
> >> >
> >> >> Hi all,
> >> >>
> >> >> Actually i'm using a customized version of servicemix-drools for the
> >> >> following reasons:
> >> >>
> >> >> 1) I need to use db helper objects both in LHS, and in RHS of my drl files.
> >> >>
> >> >> 2) I need to specify a defaultTargetService URI if no rule would be true.
> >> >>
> >> >> At the moment i'm trying to apply the approach described here, to see if
> >> >> it could feet my needs:
> >> >>
> >> >> http://gnodet.blogspot.com/2007/06/accessing-databases-in-servicemix.html
> >> >>
> >> >> but i found some problems:
> >> >>
> >> >> 1) the syntax described seems to be not correct, i don't know which is
> >> >> the right value for
> >> >> util namespace used.
> >> >>
> >> >> 2) With this approach Drools Db helper cannot be used on the LHS side of
> >> >> the rules.
> >> >>
> >> >> Any idea??
> >> >> Until i don't resolve this i'm forced to mantain my own version that
> >> >> simple assert a db helper
> >> >> object in the working memory..
> >> >>
> >> >> Andrea
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >>
> >
> >
> >
> >
>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
Re: Drools DbHelper in LHS of rule??
Posted by Andrea Zoppello <zo...@tiscali.it>.
Hi Guillaume,
See my comments inline:
Guillaume Nodet ha scritto:
> The main problem I had with your patch is that a QName for the target sevice
> may not always be sufficient. I was thinking about using a uri or something as
>
Yes i agree with you, i've just discussed about that with other guys
from iona on spagic jira.
We agree the best solution could be to have an endpoint where you could
specify:
defaultTargetService *or* defaultTargetURI where defaultTargetURI have
the precedence on defaultTargetService.
> in the eip component.
> <eip:exchange-target service="test:routingSlip" />
> See http://servicemix.apache.org/servicemix-eip.html#servicemix-eip-ExchangeTarget
>
> As for using the Db helper in the globals, look at this example:
> http://servicemix.apache.org/servicemix-drools.html#servicemix-drools-Injectingadditionalbeansintherules
> The util namespace is bound to the spring namespace:
>
Just seen this, but notice that this example use the global jbi objetc
on RHS part of the rule non in LHS.
> http://static.springframework.org/spring/docs/2.0.x/reference/xsd-config.html#xsd-config-body-schemas-util
>
>
Thanks i was missing this point about spring.
> Btw, how did you assert this object in memory ? Is there something to
> do in the java code for that ?
>
I've simply modified the component in
DroolsEndpoint.populateWorkingMemory i add this line:
memory.assertObject(new DbHelper( ));
that's all.
Maybe a solution was to inject ( with spring ) not only the globals
object but also, the helper objects to be asserted in memory ( another
Map in DroolsEndpoint class ).
Andrea
> On Fri, Feb 22, 2008 at 1:41 PM, Andrea Zoppello <zo...@tiscali.it> wrote:
>
>> Hi Guillaume,
>>
>> It's not a *packaging problem*, my dbhelper objetct is in the classpath,
>> so in the drl file i'm
>> able to view it.
>>
>> The problem is that if i use the technique you describe ( to put the
>> dbhelper object ) in drools
>> global entry i'm not able to write rules like:
>>
>> rule "Rule1"
>> when
>> me : Exchange( status == Exchange.ACTIVE, in : in != null );
>> db : DbHelper ( );
>> eval( db.exist( in.valueOf("/ACTION/@name"), "STRING",
>> "attribute", "name", "metadb" ) );
>> then
>> jbi.fault( "<ERROR> The value is already present in db </ERROR>" );
>> end
>>
>> The only think i need is to use the dbhelper object in Left part of the
>> rule, and this seems to work very well if the dbhelper object is
>> asserted in memory, on the other side i'm not sure this is possible if
>> the object is in *global* area of working memory.
>>
>> I've just tried to have my helper as you describe, but i'm not able to
>> write a drools rule that use it in left side part.
>>
>> BTW could you pust a full xbean.xml for the example so i could see also
>> the namespace declaration for that part:
>>
>> <util:map id="globals">
>> <entry key="helper" value-ref="helper" />
>> </util:map>
>>
>>
>> BTW my diff are already here:
>>
>> https://issues.apache.org/activemq/browse/SM-888
>>
>> but it seem that were not accepted.
>>
>> Andrea
>>
>>
>>
>> Guillaume Nodet ha scritto:
>>
>>
>>
>>> Have you tried embedding your specific DbHelper in your SU instead of
>>>
>> > repackaging the component ? It may prove easier.
>> >
>> > Anyway, what does 1 lead to ? Did you had to change the DbHelper for that ?
>> > Maybe you can post a diff so that we can review and discuss it ?
>> >
>> > On Fri, Feb 22, 2008 at 11:52 AM, Andrea Zoppello <zo...@tiscali.it> wrote:
>> >
>> >> Hi all,
>> >>
>> >> Actually i'm using a customized version of servicemix-drools for the
>> >> following reasons:
>> >>
>> >> 1) I need to use db helper objects both in LHS, and in RHS of my drl files.
>> >>
>> >> 2) I need to specify a defaultTargetService URI if no rule would be true.
>> >>
>> >> At the moment i'm trying to apply the approach described here, to see if
>> >> it could feet my needs:
>> >>
>> >> http://gnodet.blogspot.com/2007/06/accessing-databases-in-servicemix.html
>> >>
>> >> but i found some problems:
>> >>
>> >> 1) the syntax described seems to be not correct, i don't know which is
>> >> the right value for
>> >> util namespace used.
>> >>
>> >> 2) With this approach Drools Db helper cannot be used on the LHS side of
>> >> the rules.
>> >>
>> >> Any idea??
>> >> Until i don't resolve this i'm forced to mantain my own version that
>> >> simple assert a db helper
>> >> object in the working memory..
>> >>
>> >> Andrea
>> >>
>> >>
>> >
>> >
>> >
>> >
>>
>>
>>
>
>
>
>
Re: Drools DbHelper in LHS of rule??
Posted by Guillaume Nodet <gn...@gmail.com>.
The main problem I had with your patch is that a QName for the target sevice
may not always be sufficient. I was thinking about using a uri or something as
in the eip component.
<eip:exchange-target service="test:routingSlip" />
See http://servicemix.apache.org/servicemix-eip.html#servicemix-eip-ExchangeTarget
As for using the Db helper in the globals, look at this example:
http://servicemix.apache.org/servicemix-drools.html#servicemix-drools-Injectingadditionalbeansintherules
The util namespace is bound to the spring namespace:
http://static.springframework.org/spring/docs/2.0.x/reference/xsd-config.html#xsd-config-body-schemas-util
Btw, how did you assert this object in memory ? Is there something to
do in the java code for that ?
On Fri, Feb 22, 2008 at 1:41 PM, Andrea Zoppello <zo...@tiscali.it> wrote:
> Hi Guillaume,
>
> It's not a *packaging problem*, my dbhelper objetct is in the classpath,
> so in the drl file i'm
> able to view it.
>
> The problem is that if i use the technique you describe ( to put the
> dbhelper object ) in drools
> global entry i'm not able to write rules like:
>
> rule "Rule1"
> when
> me : Exchange( status == Exchange.ACTIVE, in : in != null );
> db : DbHelper ( );
> eval( db.exist( in.valueOf("/ACTION/@name"), "STRING",
> "attribute", "name", "metadb" ) );
> then
> jbi.fault( "<ERROR> The value is already present in db </ERROR>" );
> end
>
> The only think i need is to use the dbhelper object in Left part of the
> rule, and this seems to work very well if the dbhelper object is
> asserted in memory, on the other side i'm not sure this is possible if
> the object is in *global* area of working memory.
>
> I've just tried to have my helper as you describe, but i'm not able to
> write a drools rule that use it in left side part.
>
> BTW could you pust a full xbean.xml for the example so i could see also
> the namespace declaration for that part:
>
> <util:map id="globals">
> <entry key="helper" value-ref="helper" />
> </util:map>
>
>
> BTW my diff are already here:
>
> https://issues.apache.org/activemq/browse/SM-888
>
> but it seem that were not accepted.
>
> Andrea
>
>
>
> Guillaume Nodet ha scritto:
>
>
> > Have you tried embedding your specific DbHelper in your SU instead of
> > repackaging the component ? It may prove easier.
> >
> > Anyway, what does 1 lead to ? Did you had to change the DbHelper for that ?
> > Maybe you can post a diff so that we can review and discuss it ?
> >
> > On Fri, Feb 22, 2008 at 11:52 AM, Andrea Zoppello <zo...@tiscali.it> wrote:
> >
> >> Hi all,
> >>
> >> Actually i'm using a customized version of servicemix-drools for the
> >> following reasons:
> >>
> >> 1) I need to use db helper objects both in LHS, and in RHS of my drl files.
> >>
> >> 2) I need to specify a defaultTargetService URI if no rule would be true.
> >>
> >> At the moment i'm trying to apply the approach described here, to see if
> >> it could feet my needs:
> >>
> >> http://gnodet.blogspot.com/2007/06/accessing-databases-in-servicemix.html
> >>
> >> but i found some problems:
> >>
> >> 1) the syntax described seems to be not correct, i don't know which is
> >> the right value for
> >> util namespace used.
> >>
> >> 2) With this approach Drools Db helper cannot be used on the LHS side of
> >> the rules.
> >>
> >> Any idea??
> >> Until i don't resolve this i'm forced to mantain my own version that
> >> simple assert a db helper
> >> object in the working memory..
> >>
> >> Andrea
> >>
> >>
> >
> >
> >
> >
>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
Re: Drools DbHelper in LHS of rule??
Posted by Andrea Zoppello <zo...@tiscali.it>.
Hi Guillaume,
It's not a *packaging problem*, my dbhelper objetct is in the classpath,
so in the drl file i'm
able to view it.
The problem is that if i use the technique you describe ( to put the
dbhelper object ) in drools
global entry i'm not able to write rules like:
rule "Rule1"
when
me : Exchange( status == Exchange.ACTIVE, in : in != null );
db : DbHelper ( );
eval( db.exist( in.valueOf("/ACTION/@name"), "STRING",
"attribute", "name", "metadb" ) );
then
jbi.fault( "<ERROR> The value is already present in db </ERROR>" );
end
The only think i need is to use the dbhelper object in Left part of the
rule, and this seems to work very well if the dbhelper object is
asserted in memory, on the other side i'm not sure this is possible if
the object is in *global* area of working memory.
I've just tried to have my helper as you describe, but i'm not able to
write a drools rule that use it in left side part.
BTW could you pust a full xbean.xml for the example so i could see also
the namespace declaration for that part:
<util:map id="globals">
<entry key="helper" value-ref="helper" />
</util:map>
BTW my diff are already here:
https://issues.apache.org/activemq/browse/SM-888
but it seem that were not accepted.
Andrea
Guillaume Nodet ha scritto:
> Have you tried embedding your specific DbHelper in your SU instead of
> repackaging the component ? It may prove easier.
>
> Anyway, what does 1 lead to ? Did you had to change the DbHelper for that ?
> Maybe you can post a diff so that we can review and discuss it ?
>
> On Fri, Feb 22, 2008 at 11:52 AM, Andrea Zoppello <zo...@tiscali.it> wrote:
>
>> Hi all,
>>
>> Actually i'm using a customized version of servicemix-drools for the
>> following reasons:
>>
>> 1) I need to use db helper objects both in LHS, and in RHS of my drl files.
>>
>> 2) I need to specify a defaultTargetService URI if no rule would be true.
>>
>> At the moment i'm trying to apply the approach described here, to see if
>> it could feet my needs:
>>
>> http://gnodet.blogspot.com/2007/06/accessing-databases-in-servicemix.html
>>
>> but i found some problems:
>>
>> 1) the syntax described seems to be not correct, i don't know which is
>> the right value for
>> util namespace used.
>>
>> 2) With this approach Drools Db helper cannot be used on the LHS side of
>> the rules.
>>
>> Any idea??
>> Until i don't resolve this i'm forced to mantain my own version that
>> simple assert a db helper
>> object in the working memory..
>>
>> Andrea
>>
>>
>
>
>
>
Re: Drools DbHelper in LHS of rule??
Posted by Guillaume Nodet <gn...@gmail.com>.
Have you tried embedding your specific DbHelper in your SU instead of
repackaging the component ? It may prove easier.
Anyway, what does 1 lead to ? Did you had to change the DbHelper for that ?
Maybe you can post a diff so that we can review and discuss it ?
On Fri, Feb 22, 2008 at 11:52 AM, Andrea Zoppello <zo...@tiscali.it> wrote:
> Hi all,
>
> Actually i'm using a customized version of servicemix-drools for the
> following reasons:
>
> 1) I need to use db helper objects both in LHS, and in RHS of my drl files.
>
> 2) I need to specify a defaultTargetService URI if no rule would be true.
>
> At the moment i'm trying to apply the approach described here, to see if
> it could feet my needs:
>
> http://gnodet.blogspot.com/2007/06/accessing-databases-in-servicemix.html
>
> but i found some problems:
>
> 1) the syntax described seems to be not correct, i don't know which is
> the right value for
> util namespace used.
>
> 2) With this approach Drools Db helper cannot be used on the LHS side of
> the rules.
>
> Any idea??
> Until i don't resolve this i'm forced to mantain my own version that
> simple assert a db helper
> object in the working memory..
>
> Andrea
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/