Regex parsing of drl file versus Visitor pattern
by mikeg
My project uses Drools type declarations with custom annotations that are
used to assist in the dynamic mapping of underlying domain data to drools
fact types.
I need to provide a Swing user interface for rule creation that guides the
user through the custom type declarations, rules, and functions. Guvnor
doesn't seem to be a good fit.
I've looked at drools-verifier (and the older DrlDumper class) and its use
of the Visitor pattern to traverse a rule package, but it is a lot of work
to implement just for the type declaration enhancements. Producing
identical DRL to the imported file seems difficult. Also, any inline
comments and formatting is lost.
Alternatively, I could parse (via regex patterns) the DRL to extract the
type declarations, rules, and functions and then reconstruct the complete
package file. This seems simpler, though brittle. Also, the regex gets
complicated when attempting to get extended information (metadata,
annotations, etc.).
Any thoughts on either approach? Is there an easier way to process a rules
file into a simple data model that doesn't lose the original DRL syntax?
--
View this message in context: http://drools.46999.n3.nabble.com/Regex-parsing-of-drl-file-versus-Visito...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
ConsequenceException when using modify
by Vakimshaar
Hi everybody,
I have been struggling with a problem for a few hours now.
Basically, what I am trying to do is set a default value to variable1 in a
first rule. Then executes an other rule that checks the value of variable1
and set variable2 to a specific value under some conditions. Right now, my
rules go like this :
rule "First rule: default"
salience 10
lock-on-active true
when
$myObject : MyObject()
then
modify($myObject) {
setVariable1(defaultValue);
}
end
rule "Second rule"
salience 0
lock-on-active false
when
$myObject : MyObject(variable1 == defaultValue)
then
$myObject.setVariable2(value2);
end
When those rules are executed, an exception is thrown :
org.drools.runtime.rule.ConsequenceException: rule: First rule: default
...
Caused by: java.lang.NullPointerException
When I remove the "modify" in the first rule, the exception is not thrown
but obviously the second rule is not properly executed ...
What is the problem ? What am I doing wrong ?
Thanks for your help!
Vak'
--
View this message in context: http://drools.46999.n3.nabble.com/ConsequenceException-when-using-modify-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Failed to get rules from Guvor after apply Security using Tomcat and JAAS
by mujoko mujoko
Dear Rules Users,
Previously, I use guvnor with no security.
Now, my boss wants me to apply security on guvnor.
The way I implement is use this link
http://ngjweb.wordpress.com/2011/12/07/drools-guvnor-manage-access-part-2/
which is using realm of tomcat and create a table is the system for guvnor
user.
I tested from browser, the security is working fine even more than 10 users
access concurrently.
But when my application access the guvnor and try to create the knowledge
base. It's becoming intermittent.
After several time access the guvnor, the guvnor is hang/can not access
even from browser.
Here is the exception I got
java.lang.RuntimeException: java.io.IOException: Server returned HTTP
response code: 401 for URL:
http://localhost:9090/guvnor/org.drools.guvnor.Guvnor/package/com.rbtsb.t...
pCDR-LocalcallWithBRemarks.drl
....
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:692)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37
The way our app access the guvnor after apply security is as below.
Snipped Code
UrlResource urlResource = (UrlResource)
ResourceFactory.newUrlResource(ruleUrl);
urlResource.setBasicAuthentication("enabled");
urlResource.setUsername("admin");
urlResource.setPassword("admin");
builder.add(urlResource,ResourceType.DRL);
--
Mujoko
http://www.linkedin.com/in/mujoko
12 years, 10 months
Can we edit "view source " option in Drools Guvnor
by Veera
Hi All,
I dont know wheter it is possible or not.
i was create a one Decison Table with 100 rules( 100 rows) , So i want to
copy
this decision table into another new Guvnor
(if i export the repository i am loosing the data which is there already in
new Guvnor )
So my requirement is to copy the Decision table into new Guvnor without
loosing the existing data in
new Guvnor.
(OR) else is there any way to edit the "view source" option , So that i can
copy the code into the new
Guvnor...
Thanks in Advance,
Regards,
Veera
--
View this message in context: http://drools.46999.n3.nabble.com/Can-we-edit-view-source-option-in-Drool...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Fwd: Re: Guvnor - expected value of a list
by Michael Anstis
sent on the move
---------- Forwarded message ----------
From: "Péter Gombás" <gombas.peter(a)gmail.com>
Date: 15 Feb 2012 07:40
Subject: Re: [rules-users] Guvnor - expected value of a list
To: <michael.anstis(a)gmail.com>
Hello Michael,
yes, it is a Test scenario in Guvnor. In attachment is a very simple
project. Target is to check the resulting list. On the picture you can
see the problem: altough expected values are the same as target the
test is not succesful. Or am i using it not correctly?
Peter
2012/2/14 Michael Anstis <michael.anstis(a)gmail.com>:
> I assume this is a QA \ Test Scenario in Guvnor?
>
> It's going to be helpful if you can provide an export of your repository
(or
> an extract) showing the issue.
>
>
> On 14 February 2012 16:12, gombasp <gombas.peter(a)gmail.com> wrote:
>>
>> Hello,
>>
>> I have the following problem: i would like to compare a value in expected
>> section of a Guvnor test. Guvnor says actual value is:
>>
>> (Actual: [test1, test1])
>>
>> When i enter [test1, test1] to the expected value it will not match with
>> actual.
>> Is it possible to compare list values? If yes, what is the syntax?
>>
>> Thanks,
>>
>> Peter
>>
>> --
>> View this message in context:
>>
http://drools.46999.n3.nabble.com/Guvnor-expected-value-of-a-list-tp37441...
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
--
Gombás Péter
12 years, 10 months
uninitialized planning value [error]
by Nurlan
Is it possible setting planning entity with uninitialized planning value into
solution?
if it is possible, then how? :)
plz, help me :)
When I execute my code with not null planning variables everything work
fine, but when i execute without setting planning variables I have
[Exception in thread "main" java.lang.NullPointerException]
------------------------
2012-02-14 17:32:08,119 [main] INFO Solver started: time spend (0), score
(null), new best score (null), random seed (0).
Exception in thread "main" java.lang.NullPointerException
at
org.drools.planner.core.score.definition.HardAndSoftScoreDefinition.calculateTimeGradient(HardAndSoftScoreDefinition.java:73)
at
org.drools.planner.core.score.definition.HardAndSoftScoreDefinition.calculateTimeGradient(HardAndSoftScoreDefinition.java:25)
at
org.drools.planner.core.termination.ScoreAttainedTermination.calculateSolverTimeGradient(ScoreAttainedTermination.java:52)
at
org.drools.planner.core.termination.OrCompositeTermination.calculateSolverTimeGradient(OrCompositeTermination.java:70)
at
org.drools.planner.core.termination.OrCompositeTermination.calculateSolverTimeGradient(OrCompositeTermination.java:70)
at
org.drools.planner.core.termination.PhaseToSolverTerminationBridge.calculatePhaseTimeGradient(PhaseToSolverTerminationBridge.java:49)
at
org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:55)
at
org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:166)
at
org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:138)
at kz.bee.drools.planner.dating.DatingMain.start(DatingMain.java:58)
at kz.bee.drools.planner.dating.DatingMain.main(DatingMain.java:38)
--
View this message in context: http://drools.46999.n3.nabble.com/uninitialized-planning-value-error-tp37...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months