Re: external java agent calls functions in o:XML
Francisco <jshzhang2000-/[email protected]> Mon, 12 Feb 2007 17:00:44 +0000 (GMT)
| Newsgroups | gmane.text.xml.o-xml |
|---|---|
| Message-ID | <[email protected]> |
--===============1333871599== Content-Type: multipart/alternative; boundary="0-878284011-1171299644=:24617" Content-Transfer-Encoding: 7bit --0-878284011-1171299644=:24617 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Dear Martin, =20 To my surprise, today I find your reply email dated weeks ago to me in = the bulk folder again. I was looking forward to hearing from you on this.= But I didn't receive on time. Hope it is not late to continue our discus= sion. And I am still very keen to have your help in providing an example.= During the period of time without seeing your email, I am very keen to = get some breakthrough with o:xml. I did some work and further thinking of= o:xml. =20 =20 The questions you asked in previous email are answered one by one. Plea= se have a look at the blue color section below in your email section: =20 In addition, I have some questions puzzled me, could you please help, m= any thanks: =20 1) After o:xml is interpterted by objectbox, how can the return value o= r methods be exposed or acquired to the java agents? =20 2) After the functions in o:xml are executed, the associated value of v= ariables should be changed, but will the changes be shown in oxml file or= just in memory? =20 3) Could you please kindly present an example to show how to use object= box to "randomly" invoke the methods/functions in o:xml? =20 4) Are there source codes available for objectbox? =20 I appreciate very much for your great help. =20 Thank you very much in advance! =20 =20 With warmest regards, Francisco =20 Martin Klang <[email protected]> wrote: Hi Francisco, If I understand your problem correctly then what follows might be an=20 interesting solution - though first a couple of notes - The o:XML execution model has the notion of a session. The session is=20 essentially a hash table, where variables can be stored and reused in=20 between program invocations. It was designed for programs handling=20 web requests, but can be used in any execution context. Session=20 variables are important, because in o:XML there are no static or=20 global variables. Furthermore o:XML programs can be compiled once then executed (by=20 concurrent threads) any number of times. So the solution would be to create an o:XML controller that receives=20 requests from your Java agents, then compiles (if necessary) and=20 invokes the right o:XML program or function, with the right session=20 for storing/updating results, and then you're flying! Basically this is what the ObjectBox Servlet and Struts Action do=20 when receiving HTTP requests (ObjectBox is the o:XML Java-based=20 compiler/interpreter). You will probably need to make a few design decisions - 1) Will the agents invoke a single function defined in an o:XML=20 program, or an entire program? In o:XML, any XML file is an o:XML program, and if you use the=20 construct you can also pass parameters (such as a=20 session) to the program. Program parameters are declared much in the=20 same way as function parameters. The java agents take actions on the basis of rule-based engine. These r= ules will guide the agent to invoke associated functions (either one or m= ultiple functions up to the situations.) Each o:xml contains more than o= ne function, these functions are classified into different groups and can= only be invoked according to certain situations or rules. =20 2) How does the controller know which program/function to invoke?=20 Does the agent tell it which one, or is it set in the application=20 configuration? This is predefined into the rules. The rules tell agents which function s= hould be invoked under certain situations.=20 =20 =20 3) How and when are session variables used? Does the same agent=20 always update the same set of results, or can different agents update=20 the same set of results? The function in the o:xml can modify the values of the variables in the= same o:xml files. The java agents' behaviors are dependent on the rules = which are linked with situations. To simplify simualtion at this stage, w= e assume same agent update teh same set of results.=20 =20 4) How are results accessed? Are they accessed realtime in some form=20 of console, or collated at the end of the process, output to a log=20 file..? =20 We prefer the results accessed in real-time mode which means the values= of the variables can be modified by the functions whenver networks need.= But if it is not easy, currently I do not mind to have a log file to rec= ord the results. I can easily knock together a working example if you can answer the=20 above questions and give me some idea of what the requests coming=20 from the Java agents might look like. The Java agents governed by the rules and could tackle with methods in = o:xml like 1) getCurrentValue 2) setValue 3) getUpdatedFrequency etc. =20 Thank you so much!!! However, you might also want to consider using a framework such as=20 Spring. As described in a previous posting [1], o:XML can integrate=20 with Spring and this can be used to tie Java code into o:XML code,=20 and vice versa. It also has the significant advantage of integrating=20 with several other scripting languages, eg Ruby and Groovy. An updated version of ObjectBox including Spring integration should=20 be out in the next few weeks. =20 best regards, /m [1] http://lists.pingdynasty.com/pipermail/o-xml/2006q2/000087.html On 11 Jan 2007, at 2:05, Francisco wrote: > Dear All and Martin, > > I am quite interested in external java agents calling functions in=20 > o:XML files. I am not sure if this can be done provided that=20 > current o:XML API and libraries. > > Can anybody provide me an example or explain if this can be done?=20 > the details of this thinking is described as follows: > > Currently I would like to describe the object-oriented MIB with=20 > O:XML language. This O:XML "configuration" file is written=20 > beforehand and java agents do NOT need to generate this o:XML,=20 > whereas, java agents need to invoke the methods predefined in this=20 > file with regards to event notifications, and reassign the value of=20 > the variables in o:XML file itself. In > addition, the java agents could act in either multiple threads mode=20 > simutaneously or > operate one after one another. We could always make it complicated=20 > later. Currently > I am confused by the possible implementation of methods invoked by=20 > java agents. I am > not sure if there are available API or library for this external=20 > operation done by java agents. > > Thank you in advance for providing me with a simple example about=20 > this. Your help is highly appreciated and will be acknowledged in=20 > the in future network management research. > > Looking forward to hearing from you very soon. > > Best regards, > Francisco > > =09 --------------------------------- All new Yahoo! Mail "The new Interface is stunning in its simplicity and= ease of use." - PC Magazine --0-878284011-1171299644=:24617 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <div>Dear Martin,</div> <div> </div> <div>To my surprise, today I = find your reply email dated weeks ago to me in the bulk folder again. I w= as looking forward to hearing from you on this. But I didn't receive on&n= bsp;time. Hope it is not late to continue our discussion. And I am s= till very keen to have your help in providing an example. During th= e period of time without seeing your email, I am very keen to get some br= eakthrough with o:xml. I did some work and further thinking of = o:xml. </div> <div> </div> <div>The questions you asked= in previous email are answered one by one. Please have a look at the blu= e color section below in your email section:</div> <div> = </div> <div>In addition, I have some questions puzzled me, could yo= u please help, many thanks:</div> <div> </div> <div>1) After o:xml= is interpterted by objectbox, how can the return value or = ;methods be exposed or acquired to the java agents?</div> <div> </div> <div>2) After the functions i= n o:xml are executed, the associated value of variables should be changed= , but will the changes be shown in oxml file or just in memory?</div> <d= iv> </div> <div>3) Could you please kindly present an example to sh= ow how to use objectbox to "randomly" invoke the methods/functions i= n o:xml?</div> <div> </div> <div>4) Are there source codes av= ailable for objectbox?</div> <div> </div> <div>I appreciate very m= uch for your great help.</div> <div> </div> <div>Thank you very mu= ch in advance!</div> <div> </div> <div> </div> <div>With war= mest regards,</div> <div>Francisco</div> <div><BR><B><I>Martin Klang &l= t;[email protected]></I></B> wrote:</div> <BLOCKQUOTE class=3Dreplbq s= tyle=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px sol= id"> <div>Hi Francisco,<BR><BR>If I understand your problem correctly th= en what follows might be an <BR>interesting solution - though first a couple of notes -<BR><BR>The o:XML execution m= odel has the notion of a session. The session is <BR>essentially a hash t= able, where variables can be stored and reused in <BR>between program inv= ocations. It was designed for programs handling <BR>web requests, but can= be used in any execution context. Session <BR>variables are important, b= ecause in o:XML there are no static or <BR>global variables.<BR><BR>Furth= ermore o:XML programs can be compiled once then executed (by <BR>concurre= nt threads) any number of times.<BR><BR>So the solution would be to creat= e an o:XML controller that receives <BR>requests from your Java agents, t= hen compiles (if necessary) and <BR>invokes the right o:XML program or fu= nction, with the right session <BR>for storing/updating results, and then= you're flying!<BR><BR>Basically this is what the ObjectBox Servlet and S= truts Action do <BR>when receiving HTTP requests (ObjectBox is the o:XML = Java-based <BR>compiler/interpreter).<BR><BR>You will probably need to make a few d= esign decisions -<BR><BR>1) Will the agents invoke a single function defi= ned in an o:XML <BR>program, or an entire program?<BR>In o:XML, any XML f= ile is an o:XML program, and if you use the <BR><o:program>construct you = can also pass parameters (such as a <BR>session) to the program. Program = parameters are declared much in the <BR>same way as function parameters.<= BR></o:program></div> <div><o:program><FONT color=3D#0000ff>The java age= nts take actions on the basis of rule-based engine. These rules will= guide the agent to invoke associated functions (either one or multiple f= unctions up to the situations.) Each o:xml contains more than = one function, these functions are classified into different groups and ca= n only be invoked according to certain situations or rules.</FONT></div><= /o:program><o:program></o:program></BLOCKQUOTE> <BLOCKQUOTE class=3Drepl= bq style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><o:program> <div><BR>2) How does t= he controller know which program/function to invoke? <BR>Does the agent t= ell it which one, or is it set in the application <BR>configuration?<BR><= FONT color=3D#4040ff>This is predefined into the rules. The rules te= ll agents which function should be invoked under certain situations. = ;</FONT></div> <div> </div> <div><BR>3) How and when are session v= ariables used? Does the same agent <BR>always update the same set of resu= lts, or can different agents update <BR>the same set of results?<BR></div= > <div><FONT color=3D#4040ff>The function in the o:xml can modify the va= lues of the variables in the same o:xml files. The java agents' behaviors= are dependent on the rules which are linked with situations. To simplify= simualtion at this stage, we assume same agent update teh same set of re= sults. </FONT></div> <div><BR>4) How are results accessed? Are they= accessed realtime in some form <BR>of console, or collated at the end of the process, output to a log <BR>file= ..?</div> <div> </div> <div><FONT color=3D#4040ff>We prefer the re= sults accessed in real-time mode which means the values of the variables = can be modified by the functions whenver networks need. But if it is not = easy, currently I do not mind to have a log file to record the results.</= FONT><BR><BR>I can easily knock together a working example if you can ans= wer the <BR>above questions and give me some idea of what the requests co= ming <BR>from the Java agents might look like.<BR></div> <div><FONT colo= r=3D#4040ff>The Java agents governed by the rules and could tackle with m= ethods in o:xml like 1) getCurrentValue<BR>2) setValue<BR>3) getUpdatedFr= equency<BR></div></FONT> <div><FONT color=3D#4040ff>etc.</FONT></div> <= div><FONT color=3D#4040ff></FONT> </div> <div><FONT color=3D#4040ff= >Thank you so much!!!</FONT><BR><BR>However, you might also want to consi= der using a framework such as <BR>Spring. As described in a previous posting [1], o:XML can integrate <BR>with Spring= and this can be used to tie Java code into o:XML code, <BR>and vice vers= a. It also has the significant advantage of integrating <BR>with several = other scripting languages, eg Ruby and Groovy.<BR>An updated version of O= bjectBox including Spring integration should <BR>be out in the next few w= eeks.<BR></div> <div><BR>best regards,<BR><BR>/m<BR><BR><BR>[1] http://l= ists.pingdynasty.com/pipermail/o-xml/2006q2/000087.html<BR><BR><BR>On 11 = Jan 2007, at 2:05, Francisco wrote:<BR><BR>> Dear All and Martin,<BR>&= gt;<BR>> I am quite interested in external java agents calling functio= ns in <BR>> o:XML files. I am not sure if this can be done provided th= at <BR>> current o:XML API and libraries.<BR>><BR>> Can anybody = provide me an example or explain if this can be done? <BR>> the detail= s of this thinking is described as follows:<BR>><BR>> Currently I w= ould like to describe the object-oriented MIB with <BR>> O:XML language. This O:XML "configurat= ion" file is written <BR>> beforehand and java agents do NOT need to g= enerate this o:XML, <BR>> whereas, java agents need to invoke the meth= ods predefined in this <BR>> file with regards to event notifications,= and reassign the value of <BR>> the variables in o:XML file itself. I= n<BR>> addition, the java agents could act in either multiple threads = mode <BR>> simutaneously or<BR>> operate one after one another. We = could always make it complicated <BR>> later. Currently<BR>> I am c= onfused by the possible implementation of methods invoked by <BR>> jav= a agents. I am<BR>> not sure if there are available API or library for= this external <BR>> operation done by java agents.<BR>><BR>> Th= ank you in advance for providing me with a simple example about <BR>> = this. Your help is highly appreciated and will be acknowledged in <BR>>= ; the in future network management research.<BR>><BR>> Looking forward to hearing from you very soon.= <BR>><BR>> Best regards,<BR>> Francisco<BR>><BR>><BR><BR><= /div></BLOCKQUOTE><BR></o:program><p>  <hr size=3D1>=20 <a href=3D"http://us.rd.yahoo.com/mail/uk/taglines/yahoo_co_uk/nowyoucan/= pc_mag/*http://us.rd.yahoo.com/evt=3D40569/*http://uk.docs.yahoo.com/nowy= oucan.html">All new Yahoo! Mail</a> "The new Interface is stunning in its= simplicity and ease of use." - PC Magazine --0-878284011-1171299644=:24617-- --===============1333871599== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ o-xml mailing list o-xml-zRfLyl9bSvv/[email protected] http://lists.pingdynasty.com/mailman/listinfo/o-xml --===============1333871599==--