Re: external java agent calls functions in o:XML
If I understand your problem correctly then what follows might be an
interesting solution - though first a couple of notes -
The o:XML execution model has the notion of a session. The session is
essentially a hash table, where variables can be stored and reused in
between program invocations. It was designed for programs handling
web requests, but can be used in any execution context. Session
variables are important, because in o:XML there are no static or
Furthermore o:XML programs can be compiled once then executed (by
concurrent threads) any number of times.
So the solution would be to create an o:XML controller that receives
requests from your Java agents, then compiles (if necessary) and
invokes the right o:XML program or function, with the right session
for storing/updating results, and then you're flying!
Basically this is what the ObjectBox Servlet and Struts Action do
when receiving HTTP requests (ObjectBox is the o:XML Java-based
You will probably need to make a few design decisions -
1) Will the agents invoke a single function defined in an o:XML
program, or an entire program?
In o:XML, any XML file is an o:XML program, and if you use the
<o:program> construct you can also pass parameters (such as a
session) to the program. Program parameters are declared much in the
same way as function parameters.
2) How does the controller know which program/function to invoke?
Does the agent tell it which one, or is it set in the application
3) How and when are session variables used? Does the same agent
always update the same set of results, or can different agents update
the same set of results?
4) How are results accessed? Are they accessed realtime in some form
of console, or collated at the end of the process, output to a log
I can easily knock together a working example if you can answer the
above questions and give me some idea of what the requests coming
from the Java agents might look like.
However, you might also want to consider using a framework such as
Spring. As described in a previous posting , o:XML can integrate
with Spring and this can be used to tie Java code into o:XML code,
and vice versa. It also has the significant advantage of integrating
with several other scripting languages, eg Ruby and Groovy.
An updated version of ObjectBox including Spring integration should
be out in the next few weeks.
On 11 Jan 2007, at 2:05, Francisco wrote:
> Dear All and Martin,
> I am quite interested in external java agents calling functions in
> o:XML files. I am not sure if this can be done provided that
> current o:XML API and libraries.
> Can anybody provide me an example or explain if this can be done?
> the details of this thinking is described as follows:
> Currently I would like to describe the object-oriented MIB with
> O:XML language. This O:XML "configuration" file is written
> beforehand and java agents do NOT need to generate this o:XML,
> whereas, java agents need to invoke the methods predefined in this
> file with regards to event notifications, and reassign the value of
> the variables in o:XML file itself. In
> addition, the java agents could act in either multiple threads mode
> simutaneously or
> operate one after one another. We could always make it complicated
> later. Currently
> I am confused by the possible implementation of methods invoked by
> java agents. I am
> not sure if there are available API or library for this external
> operation done by java agents.
> Thank you in advance for providing me with a simple example about
> this. Your help is highly appreciated and will be acknowledged in
> the in future network management research.
> Looking forward to hearing from you very soon.
> Best regards,