strict-mode and nested object property access in drools 5.4.0.Final - can i cast?
by radai rosenblatt
hello.
I have the following 2 classes:
public class ClassWithPayload {
private String key;
private Object payload;
// getters setters etc ommitted
}
public class PayloadClass {
public String someProp;
//getters setters etc ommitted
}
and im trying to get the following rule to compile:
rule "Naive Payload Access"
when
$container : ClassWithPayload(key == "someKey", (payload != null &&
payload.someProp == "someValue"))
then
System.err.println("boom");
end
which results in the following error:
java.lang.AssertionError: Unable to Analyse Expression payload.someProp:
[Error: unable to resolve method using strict-mode:
java.lang.Object.someProp()]
[Near : {... payload.someProp ....}]
is there some way for me to cast payload.someProp to the proper class ?
(PayloadClass in this case).
this is a simplification of a bigger migration issue from drools 5.1 to 5.4
so the payload property has to remain an Object in the general case.
there's a casting syntax mentioned here
(https://community.jboss.org/wiki/DroolsPatternLanguage) but i take it its
not been implemented yet? (or maybe i just cant understand it properly?)
i've tried this:
rule "Naive Payload Access"
when
$container : ClassWithPayload(key == "someKey", (payload != null &&
payload.#PayloadClass(someProp == "someValue")))
then
System.err.println("boom");
end
but it doesnt compile:
java.lang.AssertionError: [8,51]: [ERR 101] Line 8:51 no viable alternative
at input '(' in rule "Naive Payload Access"
[0,0]: Parser returned a null Package
and if i cant cast, how can i get this sort of rule to behave as it did in
5.1.1 ?
thanks in advance for any assistance,
Radai.
--
View this message in context: http://drools.46999.n3.nabble.com/strict-mode-and-nested-object-property-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
Drools 5.0 to 5.4 upgrade
by Ben Cuthbert
After upgrading the jars to the latest version I am getting this when starting my rules
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
Caused by: java.lang.NoSuchFieldError: COMPILER_OPT_ALLOW_RESOLVE_INNERCLASSES_WITH_DOTNOTATION
at org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:969)
at org.drools.rule.builder.PatternBuilder.buildRelationalExpression(PatternBuilder.java:669)
at org.drools.rule.builder.PatternBuilder.buildExpression(PatternBuilder.java:634)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:618)
at org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternBuilder.java:449)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:310)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:118)
at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:67)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:84)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2706)
at org.drools.compiler.PackageBuilder.compileRules(PackageBuilder.java:930)
at org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:839)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:831)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:467)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:673)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:45)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34)
12 years, 6 months
Problem with ObjectFatory for jaxb objects
by devan.vanreenen@gmail.com
Hi there,
I uploaded a domain model to a package on Guvnor
The imported objects contain jaxb objects from 2 different schemas
included in the package imports are
import uk.co.myapp.rules.ObjectFactory
import uk.co.myapp.rules.domain.policy.ObjectFactory
My rules objects use uk.co.myapp.rules.ObjectFactory but I am trying to
create a function which uses objects that use
uk.co.myapp.rules.domain.policy.ObjectFactory but the function fails to
compile
[calcAgeNext] [ calcAgeNext : Function Compilation error
calcAgeNext (line:-100): The import
uk.co.myapp.rules.domain.policy.ObjectFactory collides with another import
statement
]
Please assist, how can I fix this.
Thanks
Devan
--
View this message in context: http://drools.46999.n3.nabble.com/Problem-with-ObjectFatory-for-jaxb-obje...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
Memory Control
by Kang Heng WU
Hi All,
The performance of JBoss Expert and Fusion is fine. The throughput of
JBoss Expert and Fusion is about 9900 and 4500 messages per second. But
we meet the following problems.
When the number of handled messages is about 500,000, the performance of
Expert is very slow. Its memory is about 300 Mbyte.
When the number of handled messages is about 300,000, the performance of
Fusion is very slow. Its memory is about 300 Mbyte.
What is the problem? How can we solve it?
Thanks in advance,
Kent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This message (including any attachments) is for the named
addressee(s)'s use only. It may contain sensitive, confidential,
private proprietary or legally privileged information intended for a
specific individual and purpose, and is protected by law. If you are
not the intended recipient, please immediately delete it and all copies
of it from your system, destroy any hard copies of it
and notify the sender. Any use, disclosure, copying, or distribution of
this message and/or any attachments is strictly prohibited.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 years, 6 months