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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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
 >>
 >>
 >
 >
 >
 >






Reply via email to