Re: external java agent calls functions in o:XML

Francisco <jshzhang2000-/[email protected]> Fri, 16 Feb 2007 06:33:30 +0000 (GMT)
Newsgroups gmane.text.xml.o-xml
Message-ID <[email protected]>
--===============1825912386==
Content-Type: multipart/alternative; boundary="0-2073589007-1171607610=:85474"
Content-Transfer-Encoding: 7bit

--0-2073589007-1171607610=:85474
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Dear Martin,
  =20
  I couldn't find the class "ProgramFactory" as you suggested as below.=20
  =20
  I even tried to look at the objectbox, but couldn't find it. Could you =
please kindly let me know where I can find it? Your great help is highly =
appreciated.

  =20
  Looking forward to your reply.
  =20
  =20
  Kind regards,
Francisco
  =20
  =20
  =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
  import org.oXML.type.*;
import org.oXML.engine.*;
...
String systemId =3D "your-file.oml";
Name functionName =3D new Name("your-function");
Type[] signature =3D new Type[]{}; // default sig, ie your-function()
Node[] args =3D new Node[]{}; // empty args
...
ProgramFactory pfactory =3D new ProgramFactory();
pfactory.loadDefaultExtensions();
InterpretedProgram program =3D pfactory.getProgram(systemId);
pfactory.compile(program);
Function func =3D program.getResolver().getFunction(functionName, =20
signature);
RuntimeContext env =3D new RuntimeContext(program);
Node result =3D func.invoke(args, env);
String stringResult =3D result.stringValue();
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Martin Klang <[email protected]> wrote:
  Hi Francisco,

The o:XML db extensions will work with any database that you can find=20
a JDBC driver for, eg MySQL, PostgreSQL, HSQL, Oracle, db2, MS SQL=20
Server, ODBC data sources etc.

Cache (like most oo databases) provides several options for=20
persisting data, one of them is SQL over JDBC - see http://=20
www.cachemonitor.de/cache-monitor/docu/cache-jdbc-driver-=20
versions.html for info on drivers.

All you have to do is put the JDBC driver in the classpath, and=20
provide the connection details to the db:connection object. The=20
documentation is here:
http://www.o-xml.org/documentation/obox-db-extensions.html


best regards,


/m

On 14 Feb 2007, at 6:38, Francisco wrote:

> Dear Martin,
>
> Thank you so much for your kind reply. I appreciate very much. I=20
> will carry on a test based on your suggestion and definitely will=20
> go back to you.
>
> I am planning to link database with o;xml, but I am wondering if=20
> the conventional SQL database or newer Object-oriented DB (e.g.,=20
> Cache) are all supported by o:xml?
>
> Millions of thanks,
> Kind regards,
> Francisco



 	=09
---------------------------------
 Next-generation email? Now you can have it with All New Yahoo! Mail.
--0-2073589007-1171607610=:85474
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Dear Martin,</div>  <div>&nbsp;</div>  <div>I couldn't find the clas=
s "ProgramFactory" as you suggested as below. </div>  <div>&nbsp;</div>  =
<div>I even tried to look at the objectbox, but couldn't find it. Could y=
ou please kindly let me know where I can find it? Your great help is high=
ly appreciated.<BR></div>  <div>&nbsp;</div>  <div>Looking forward to&nbs=
p;your reply.</div>  <div>&nbsp;</div>  <div>&nbsp;</div>  <div>Kind rega=
rds,<BR>Francisco</div>  <div>&nbsp;</div>  <div>&nbsp;</div>  <div>=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
</div>  <div>import org.oXML.type.*;<BR>import org.oXML.engine.*;<BR>...<=
BR>String systemId =3D "your-file.oml";<BR>Name functionName =3D new Name=
("your-function");<BR>Type[] signature =3D new Type[]{}; // default sig, =
ie your-function()<BR>Node[] args =3D new Node[]{}; // empty args<BR>...<=
BR>ProgramFactory pfactory =3D new ProgramFactory();<BR>pfactory.loadDefa=
ultExtensions();<BR>InterpretedProgram program =3D
 pfactory.getProgram(systemId);<BR>pfactory.compile(program);<BR>Function=
 func =3D program.getResolver().getFunction(functionName,&nbsp; <BR>signa=
ture);<BR>RuntimeContext env =3D new RuntimeContext(program);<BR>Node res=
ult =3D func.invoke(args, env);<BR>String stringResult =3D result.stringV=
alue();<BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR><B><I>Martin Klang=
 &lt;[email protected]&gt;</I></B> wrote:</div>  <BLOCKQUOTE class=3Dreplb=
q style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px =
solid">Hi Francisco,<BR><BR>The o:XML db extensions will work with any da=
tabase that you can find <BR>a JDBC driver for, eg MySQL, PostgreSQL, HSQ=
L, Oracle, db2, MS SQL <BR>Server, ODBC data sources etc.<BR><BR>Cache (l=
ike most oo databases) provides several options for <BR>persisting data, =
one of them is SQL over JDBC - see http:// <BR>www.cachemonitor.de/cache-=
monitor/docu/cache-jdbc-driver- <BR>versions.html for info on drivers.<BR=
><BR>All you have to do is put the JDBC driver in the
 classpath, and <BR>provide the connection details to the db:connection o=
bject. The <BR>documentation is here:<BR>http://www.o-xml.org/documentati=
on/obox-db-extensions.html<BR><BR><BR>best regards,<BR><BR><BR>/m<BR><BR>=
On 14 Feb 2007, at 6:38, Francisco wrote:<BR><BR>&gt; Dear Martin,<BR>&gt=
;<BR>&gt; Thank you so much for your kind reply. I appreciate very much. =
I <BR>&gt; will carry on a test based on your suggestion and definitely w=
ill <BR>&gt; go back to you.<BR>&gt;<BR>&gt; I am planning to link databa=
se with o;xml, but I am wondering if <BR>&gt; the conventional SQL databa=
se or newer Object-oriented DB (e.g., <BR>&gt; Cache) are all supported b=
y o:xml?<BR>&gt;<BR>&gt; Millions of thanks,<BR>&gt; Kind regards,<BR>&gt=
; Francisco<BR><BR></BLOCKQUOTE><BR><p>&#32;
		<hr size=3D1>=20
Next-generation email? Now you can have it with <a href=3D"http://us.rd.y=
ahoo.com/mail/uk/taglines/yahoo_co_uk/nowyoucan/next_gen/*http://us.rd.ya=
hoo.com/evt=3D40569/*http://uk.docs.yahoo.com/nowyoucan.html">All New Yah=
oo! Mail</a>.
--0-2073589007-1171607610=:85474--

--===============1825912386==
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

--===============1825912386==--