[rules-users] RES: Problem with proxy objects
Edson Tirelli
ed.tirelli at gmail.com
Fri Feb 5 14:05:01 EST 2010
Rogerio,
I don't know what javassist does with your class... if it preserves the
object hierarchy (what I think it probably does), then it must work. The
only way to find out the reason is with an isolated test case and do some
debugging to understand why it is not failing the isAssignableFrom() tests.
[]s
Edson
2010/2/5 Rogerio Baldini <rogerio.baldini at powerlogic.com.br>
> I think you didn't understand my problem.
> I don't have any problem related to Java arrays.
> My problem is drools is not working with proxy objects.
>
> I am executing drools rules with one javassist object
> (package.MyClass_$$_javassist_2) and drools is not recognizing this object
> as package.MyClass and is not executing my rule.
>
> Thanks,
>
> Rogério
>
>
>
>
> -----Mensagem original-----
> De: rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org] Em nome de Wolfgang Laun
> Enviada em: sexta-feira, 5 de fevereiro de 2010 14:13
> Para: Rules Users List
> Assunto: Re: [rules-users] Problem with proxy objects
>
> <quote from="Drools Expert Manual">
> Unfortunately a Java array does not implement the Iterable interface, so
> we
> have to use the JDK converter method Arrays.asList(...).
> </quote>
>
> Try
> ksession.execute( Arrays.asList( new Object[] { myObject} ) );
>
> -W
>
> 2010/2/5 Rogerio Baldini <rogerio.baldini at powerlogic.com.br>:
> > Hi guys,
> >
> >
> >
> > I am trying to execute rules passing a proxy object to it.
> >
> > The object myObject is a javassist proxy object:
> > package.MyClass_$$_javassist_2
> >
> >
> >
> > Properties p = new Properties();
> >
> > p.put("url",
> > "http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/
> > pacote/LATEST");
> >
> >
> >
> > RuleAgent agent = RuleAgent.newRuleAgent(p);
> >
> > RuleBase ruleBase = agent.getRuleBase();
> >
> >
> >
> > StatelessSession ksession = ruleBase.newStatelessSession();
> >
> >
> >
> > ksession.execute(new Object[] {myObject});
> >
> >
> >
> >
> >
> > So, with this proxy object, my rule is not executed. If I pass a real
> > instance, the rule works fine.
> >
> >
> >
> > package mypackage;
> >
> > import package.MyClass;
> >
> >
> >
> > global java.util.List list
> >
> >
> >
> > rule "Testing"
> >
> > dialect "java"
> >
> > when
> >
> > f: MyClass()
> >
> > then
> >
> > System.out.println("Exist "+f.getDay());
> >
> > f.setDay("15");
> >
> > end
> >
> >
> >
> >
> >
> > Can anybody help me ?
> >
> > Thanks,
> >
> > Rogerio
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100205/191e1640/attachment.html
More information about the rules-users
mailing list