I'm aware that you can do that but we are trying to segregate the code so that developers extending off my rule engine do not need to know about the drools implementation
Thanks, Susan G. Lee Distribution and New Ventures Depository Trust and Clearing Corporation 55 Water Street, New York, NY 10041 Phone: 212-855-2883 E-mail: [EMAIL PROTECTED] "Lionel Port" <[EMAIL PROTECTED]> 04/12/2006 07:40 PM Please respond to [email protected] To [email protected] cc Subject Re: [drools-user] Assert Null objects I kinda question your need for a rules engine when all your doing is delegating to another action but maybe there is more to it that your not telling us about. Anyway, if your rule is not dependant on the existence of a delegate, then don't add it as a parameter. You can do something like this. <rule name="LoginRequest"> <parameter identifier="request"> <class>com.dtcc.dnv.request.IServiceRequest</class> </parameter> <java:condition>request.getId().equals("Login")</java:condition> <java:consequence>drools.assertObject(new com.dtcc.dnv.delegate.LoginDelegate());</java:consequence> </rule> On 4/13/06, Susan G Lee <[EMAIL PROTECTED]> wrote: > > Hi Mike. > > The scenario is that in the service request and it contains a request id, > which is really a rule name. So depending on the rule name being called, > a specific delegate would handle the service request, which is why I did > what I did. Here's maybe a clearer example > > <rule name="LoginRequest"> > <parameter identifier="request"> > <class>com.dtcc.dnv.request.IServiceRequest</class> > </parameter> > <parameter identifier="delegate"> > <class>com.dtcc.dnv.delegate.IDelegate</class> > </parameter> > > <java:consequence>delegate = new > com.dtcc.dnv.delegate.LoginDelegate();</java:consequence> > > </rule> > > <rule name="DBRequest"> > <parameter identifier="request"> > <class>com.dtcc.dnv.request.IServiceRequest</class> > </parameter> > <parameter identifier="delegate"> > <class>com.dtcc.dnv.delegate.IDelegate</class> > </parameter> > > <java:consequence>delegate = new > com.dtcc.dnv.delegate.DBDelegate();</java:consequence> > > </rule> > > Thanks, > Susan G. Lee > > > > > "Michael Neale" <[EMAIL PROTECTED]> > 04/12/2006 01:29 AM > Please respond to > [email protected] > > > To > [email protected] > cc > > Subject > Re: [drools-user] Assert Null objects > > > > > > > that rule doesn't quite make sense. you can set a null pointer to a new > object in that way and have it do anything useful. > explain a bit more what you are trying to do? > > On 4/11/06, Susan G Lee <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I'm trying to genericize the use of the drl files. For example, I'm > going > > to pass in a request and from the request, I will be able to determine > > what delegate to use. So I assert a request and delegate, but the > > delegate is instantiated to null, so when i do this: > > > > rule name="testRequest"> > > <parameter identifier="request"> > > <class>com.dtcc.dnv.request.IServiceRequest</class> > > </parameter> > > <parameter identifier="delegate"> > > <class>com.dtcc.dnv.delegate.IDelegate</class> > > </parameter> > > > > <java:consequence>delegate = new > > com.dtcc.dnv.delegate.LoginDelegate();</java:consequence> > > > > </rule> > > > > it doesn't even get into the rule b/c the delegate is null. I'm using > > drools 2.5. Can someone help with this? > > > > > > Thanks, > > Susan G. Lee > > > > > > > > >
