writing Java runtime expression in XML,?

F

foobar

I have a requirement to implement a rules Engine in an application. We
want to be able to dynamically re-deploy the logic for the rules at runtime
without having to re-deploy the application. Thus, the logic would be
expressed as XML in an XML file. We would monitor if this file changes and
re-load it if it did.

However, I don't see how I can read in a static XML file and dyamically build
an arbitrary Java expression from its contents that is then interpreted
by a running application? Any thoughts as to how to approach this are appreciated.

The expression would contain class and method names with parameters and AND,
OR, NOT, parenthesis, etc. Example:

<expr>
request.getRemoteUser() != null && Foo.bar("3") != 2 || (! Bar.foo() == 9);
</expr>
 
H

Harald Kirsch

I have a requirement to implement a rules Engine in an application. We
want to be able to dynamically re-deploy the logic for the rules at runtime
without having to re-deploy the application. Thus, the logic would be
expressed as XML in an XML file. We would monitor if this file changes and
re-load it if it did.

If you don't insist on XML, you could use jython (www.jython.org) or
jacl (http://www.tcl.tk/software/java/) which are python and tcl
implementations in java. Then your rules file would be a script and
you ask the script interpreter to run it. Both languages allow to
access any java objects.

Harald.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top