DroolsCompilerAntTask
by Gael Lorent
Hi,
Is there a reason why the org.drools.contrib.DroolsCompilerAntTask generates
serialized ruleBase objects instead of packages ?
Indeed it kind of creates a lack of compatibility with the RuleAgent since
the org.drools.agent.FileScanner only accepts .pkg or .drl files, and in
terms of coding the step looks quite short.
Maybe it is done on purpose but then I would be glad to learn the deep
reason.
Thanks
--
View this message in context: http://www.nabble.com/DroolsCompilerAntTask-tp14247471p14247471.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 11 months
Using RuleAgent (URLScanner) within a webapp
by glorent
Hi,
I have some trouble trying to configure a RuleAgent listening to a snapshot
URL (exposed via BRMS) within a webapp.
The issue may be due to the fact that both BRMS and my webapp are hosted on
the same container (Tomcat) instance.
Indeed, as I start Tomcat the RuleSource initializes with my webapp, which
generates a HTTP GET request on my snapshot url, leading to an infinite wait
loop (since the container is not fully started and is not ready to handle
such requests yet).
It looks like the org.drools.agent.HttpClientImpl.fecthPackage method does
not handle any connection timeout (Using drools 4.0.3). Maybe it could
prevent from such deadlocks though.
One possible workaround would be to have my BRMS on a separate container
instance...
Maybe I am misunderstanding something ?
Would anybody have some feedback on such configurations ?
Any light appreciated
--
View this message in context: http://www.nabble.com/Using-RuleAgent-%28URLScanner%29-within-a-webapp-tp...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 11 months
Constants on LHS?
by J Michael Dean
I have not been able to figure out how to define "constants" that can
be used replace numbers, etc. on the LHS of rules, and am not quite at
the stage where I can set up a DSL. Is there a way to accomplish this?
For example, I have a simple rule to determine if glucose is below the
targeted range; the lower limit of the target is 80. Quickest
solution:
when
decision : GlucoseDecision(serumGlucoseConcentration < 80)
then
DO something
But I want to be able to write:
when
decision : GlucoseDecision(serumClucoseConcentration < lowTargetLimit)
then
Do something
so that I can set all these constants in one place, etc.
Is there a way to accomplish this inside the DRL?
- Mike
16 years, 11 months
Re: Drools and Eclipse RCP
by J Michael Dean
Sorry - I wrote this reply before realizing that you were asking about
an "editor", not just incorporating Drools into an RCP. I am posting
this in case other are having the more mundane problem of making a RCP
execute Drools rules.
- Mike
I have been trying to do this for a while, and have managed to create
an RCP that does work. I know at least one other person has responded
on this list as having accomplished it. His response indicated that
he created a separate plugin for all the Drools components, and
referred to it from his main plugin. He also indicated that the
objects needed for the DRL file had to be in the same plugin as the
Drools engine components.
This has not been my experience. I created a plugin that contains the
Drools components and the dependent jars in the /lib folder of the
Drools distribution. That plugin's Manifest.mf file must be edited to
add the line:
Eclipse-BuddyPolicy: registered
to the end because this will allow the plugin to access any other
plugins that want to be accessed by the Drools plugin. So suppose you
name your plugin MinimalDrools; the last line of the Manifest.mf
shows that it is registered as a Eclipse buddy.
Now export the plugin in a deployable format, and then drag the new
plugin into the Eclipse plugin folder and restart Eclipse.
Now your project plugin needs to depend on this newly added plugin.
In addition, in your project plugin Manifest.mf, you must add the
reciprocal part of the buddy registration:
Eclipse-RegisterBuddy: MinimalDrools
With this structure, I added a rules directory in the root of the
plugin, and in my application code:
private void fireDroolsRulesEngine() throws Exception {
GlucoseDecisionState decisionState = new GlucoseDecisionState();
Reader source;
final PackageBuilder builder = new PackageBuilder();
source = new InputStreamReader(FileLocator.toFileURL(
GlucosePlugin.getDefault().getBundle().getEntry(
"rules/GlucoseDroolRules00.drl")).openStream());
builder.addPackageFromDrl(source);
if (builder.hasErrors()) {
System.out.println(builder.getErrors().toString());
}
Package pkg = builder.getPackage();
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(pkg);
StatefulSession session = ruleBase.newStatefulSession();
// setup the debug listeners
session.addEventListener( new DebugAgendaEventListener() );
session.addEventListener( new DebugWorkingMemoryEventListener() );
// setup the audit logging
final WorkingMemoryFileLogger glucoseLogger = new
WorkingMemoryFileLogger( session );
glucoseLogger.setFileName( "glucoseLogFile" );
session.insert(decision,true);
session.insert(decisionState,true);
session.fireAllRules();
glucoseLogger.writeToDisk();
session.dispose();
}
This works. It is necessary to add the dependency of MinimalDrools to
you feature, etc. if you are exporting a complete application.
This being said, I cannot successfully run JUnit tests on the Drools
part of my RCP. I can unit test everything else, including things
like Hibernate, my database connections, etc. But the MinimalDrools
plugin does not satisfy some aspect of the Eclipse JUnit setup. The
Drools compiler does initialize, but something prevents the package
from instantiating (several previous posts on this that remain
unresolved).
Good luck.
>
> Date: Sat, 08 Dec 2007 19:04:52 +0100
> From: Michael Sizaki <Sizaki(a)gmx.de>
> Subject: [rules-users] Drools and eclipse RCP
> To: rules-users(a)lists.jboss.org
> Message-ID: <475ADCC4.2080305(a)gmx.de>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi,
>
> is it possible to use the drools editor etc in an eclipse RCP
> application? At the moment, org.drools.eclipse plugin
> depends on debug and jdt and other eclipse IDE related
> plugins.....
>
> I would want a simple way for users to enter rules into
> my RCP application.
>
> Michael
16 years, 11 months
Anybody using the BRMS with JAAS authentication under WebSphere?
by Irving Reid
I'm struggling with getting BRMS set up to do authentication under WebSphere. I configured the BRMS components.xml for JAAS, like:
<!-- Use the default WebSphere JAAS login configuration -->
<security:identity authenticate-method="#{authenticator.authenticate}"
jaas-config-name="WSLogin"/>
and try to log in, I get permission denied and in the log:
[12/8/07 14:41:15:301 EST] 00000040 WSLoginModule E SECJ4014E: Login Module com.ibm.ws.security.common.auth.module.WSLoginModuleImpl detected unsupported com.ibm.websphere.security.auth.callback.WSCredTokenCallbackImpl callback in CallbackHandler javax.security.auth.callback.UnsupportedCallbackException: Unsupported callback
at org.jboss.seam.security.Identity$1.handle(Identity.java:588)
at javax.security.auth.login.LoginContext$SecureCallbackHandler$1.run(LoginContext.java:981)
at java.security.AccessController.doPrivileged(AccessController.java:274)
at javax.security.auth.login.LoginContext$SecureCallbackHandler.handle(LoginContext.java:977)
at com.ibm.ws.security.common.auth.module.WSLoginModuleImpl.login(WSLoginModuleImpl.java:258)
at com.ibm.ws.security.common.auth.module.proxy.WSLoginModuleProxy.login(WSLoginModuleProxy.java:122)
...
- irving -
16 years, 11 months
Re: [rules-users] A question about java 1.6 and drools
by Mark Proctor
Shahin Sheidaei wrote:
> Hi Mark,
>
> Thanks again for your response, I got the response that you replied
> directly to me before and I put the question in the mailing list for
> others to see and to see if I can send emails to mailing list.
Yes you should always email the mailing lists, you caught me in a good
mood so I still answered privately - I also answered the mailing list
for the same reason, so everyone can see the answer. But typically we
only answer paying clients privately - heh, otherwise what is it they
are paying for, and how can I get a salary :)
>
> Thanks again for answering twice.
>
> Cheers,
> Shahin
>
> On 12/8/07, *Mark Proctor* <mproctor(a)codehaus.org
> <mailto:mproctor@codehaus.org> > wrote:
>
> Shahin Sheidaei wrote:
>> Hi,
>>
>> I was wondering for at least 2 days to find some information
>> about upgrading to the newest version of java for drools that I
>> finally find this page (
>> https://hudson.jboss.org/hudson/job/drools/changes ) and seems
>> that in the past day you tested drools successfully with java 1.5
>> , my question is whether anybody can say roughly when is the time
>> for upgrading to java 1.6 , is it going to be done in anytime soon ?
> All our tests work for JDK1.6, except 1, which is related to
> dynamic function reloading. So if you aren't using dynamic
> funnctions, you should be ok. We will try and fix this remaining
> issue some time in the first two quarters next year, at which
> point we will add jdk1.6 environment to continuous test system.
>>
>> Thanks,
>> --
>> Shahin Sheidaei
>>
>> Official Homepage ( www.sheidaei.com/shahin
>> <http://www.sheidaei.com/shahin> )
>> Contact Information ( www.sheidaei.com/shahin/contact
>> <http://www.sheidaei.com/shahin/contact> )
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> <mailto:rules-users@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> Shahin Sheidaei
>
> Official Homepage ( www.sheidaei.com/shahin
> <http://www.sheidaei.com/shahin> )
> Contact Information ( www.sheidaei.com/shahin/contact
> <http://www.sheidaei.com/shahin/contact> )
16 years, 11 months
Error Importing DRL into BRMS
by Jason Lee
Hi. I'm pretty new to drools (this is my second week :). When I try
to create a new package in the BRMS by importing from a DRL file, I get
this error message, which I'm hoping someone more experienced can make
sense of:
Unable to import into the package. [Unable to process import:
javax.jcr.RepositoryException: failed to resolve path relative to
/drools:repository/drools:package_area/gov.faa.wmt.scheduling.rules/assets:
Empty path element: : Empty path element: ]
There's no stack trace in the logs that I can see (the BRMS is hosted by
GlassFish, fwiw). The DRL is 188 lines long. Not too long, I guess,
but I'll not clutter things unless someone really needs to see my (ugly)
rules file. :P Thanks!
--
Jason Lee, SCJP
Software Architect -- Objectstream, Inc.
Project Mojarra Dev Team
http://blogs.steeplesoft.com
16 years, 11 months
What's the performance impact of not flattening object model?
by Mattias Nilsson
Hi,
I understand it may be hard to give a general answer to this question,
but maybe you can help me with a rule of thumb?
I'm working with a customer that has a business object model that is 3-4
levels deep. A top object with child objects that have child objects and
so on...
It is fully possible to only insert the top object into working memory
and reason over the entire object hierarchy with the help of from,
collect, nested accessors etc.
But is that not a smart way to go forward? Better to flatten the object
model and insert all of the objects into working memory?
Will not flattening the object model have a major performance impact?
Regards,
Mattias Nilsson
16 years, 11 months
Infinte Loop problem
by benjimcc
Im sure people have seen this before ive searched high and low for an answer
but no luck, fairly new to using drools so any advice would be much
appreciated. Here is a sample of my rules:
rule "Gender Desirability"
salience 400
no-loop true
when
$broker : Broker(brokerName=="bah")
Proposer(gender == "F")
then
int desirability = $broker.getDesirability() + 10;
$broker.setDesirability(desirability);
update($broker);
System.out.println("Gender Hit");
end
rule "Age Desirability"
salience 200
no-loop true
when
$broker : Broker(brokerName=="bah")
$proposer : Proposer($dob : dateOfBirth)
$rulesrequest : RulesEngineRequest($inception : inceptionDate)
eval(age_desirability_flex.isInRange($proposer.getAge($dob,$inception))==true)
then
int desirability = $broker.getDesirability() + 20;
$broker.setDesirability(desirability);
update($broker);
System.out.println("Age Hit");
end
rule "Check Desirability"
salience 190
when
$broker : Broker($des : desirability,brokerName=="europa")
eval($des < desirability_Index)
then
$broker.setInclude(false);
retract($broker);
end
Ok basically all the 'when' bits work. But what seems to happen is that
when the update happens and the rules are evaled again and it ping pongs
between the two rules as they both update the Broker object. Resulting in
the 'Check Desirability' never being hit and for debug spewing 'Gender Hit'
'Age Hit' in a infinite loop till te JVM runs out of memory and it crash and
burns.
Any help in this would be much appreciated. If you need any more
information let me know as well.
Thanks
Ben
"The views opinions and judgments expressed in this message are solely those
of the author. The message contents have not been viewed or reviewed or
approved by CDL"
--
View this message in context: http://www.nabble.com/Infinte-Loop-problem-tf4948564.html#a14168484
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 11 months