Introduction to JXPL UNCW Grid Group Jeff Brown
Introduction to JXPL UNCW Grid Group Jeff Brown 1 11/21/2020
Outline Language Basics l Origin l Extensibility l Application: OGSA-DAI l Remote Processors l Future Work l Jeff Brown 2 11/21/2020
XML for Scripting Parsers are already written l Many applications can create or edit scripts l XSLT and XPath now available in J 2 SE and allow easy manipulation l XML Schemas for validation l Jeff Brown 3 11/21/2020
JXPL Arithmetic Arbitrary precision decimal calculations l Exact integer calculations l Exact rational arithmetic l Jeff Brown 4 11/21/2020
Arithmetic Example <list xmlns="http: //www. jxpl. org/script"> <primitive name="Math"> <property name="operation" value="pow"/> </primitive> <rational numerator="2345" denominator="1234"/> <integer value="21"/> </list> <rational numerator="59292503524459543483574528608696565761146402210 435228762149810791015625" denominator="827214909907295723542403416745199315799548685 68357449865241821184"/> Jeff Brown 5 11/21/2020
User-defined Functions Local variables l Support recursion l Extend language l – User-defined functions are treated exactly like built-in primitives – Functions can overwrite built-in primitives Jeff Brown 6 11/21/2020
Before JXPL l Math. Board – Java Applet – WYSIWYG mathematical environment – User-defined functions – Graphing – Symbolic manipulation – http: //people. uncw. edu/brownj/mathboard/help Jeff Brown 7 11/21/2020
Math. Board Screen Shot Jeff Brown 8 11/21/2020
Math. Board Data Structures Based on LISP l Flexible function evaluation l Easy symbolic manipulation l Simple to string encode and parse l Jeff Brown 9 11/21/2020
Saving State l l Math. Board can write an applet tag that causes it to appear in its present state Example <APPLET ALIGN="MIDDLE" ARCHIVE="jme. jar" CODE="jme. Math. Board. class" WIDTH=346 HEIGHT=127> <PARAM NAME="inline" VALUE="true"> <PARAM NAME="1" VALUE="c: 73: 76: Serif: 0: 20: 3 [ 5 ] sup [ 4 ] [ 7 ] / - "> </APPLET> Jeff Brown 10 11/21/2020
Math. Board Programming Functions l LISP Cond statement l Create simple programs in Math. Board l Jeff Brown 11 11/21/2020
BKKC Calendar 1996 Burger King Kid Club activity calendar l Game for September l – All players put marker on day 1 – All players flip coin – If heads, move forward – If tails, move back, unless on day 1 – First player to day 30 wins Jeff Brown 12 11/21/2020
BKKC in Math. Board l people. uncw. edu/brownj/mathboard/help/game. html Underlying data structure makes it easy to extend Math. Board l Going from mathematics language to general purpose processor is natural l Jeff Brown 13 11/21/2020
Origin lf JXPL Math. Board encoded postfix strings l XML structure perfect for LISP l XML + Math. Board Engine = JXPL l Jeff Brown 14 11/21/2020
JXPL Internal Data l XML converted to Java objects – Java objects easier to manipulate than XML DOM elements (may change in future) l Jxpl. Element: common super class – Jxpl. List – Jxpl. Symbol – etc Jeff Brown 15 11/21/2020
DOM Level 3 JAX in Java 1. 5 supports DOM level 3 l Use XPath to query DOM l XMLQuery ? ? l Advances in XML support might make it feasible for JXPL to use DOM internally instead of Java objects. l Jeff Brown 16 11/21/2020
Extensibility: Defun JXPL does not provide a way to get the length of a list l Use Defun to define function “length” l Now you can use “length” just as if it were a built-in primitive l Jeff Brown 17 11/21/2020
Extensibility: Primitive Interface l public Jxpl. Element evaluate(Jxpl. Element input) l Extend JXPL by implementing simple interface Create class mypackage. My. Primitive Use name “mypackage. My. Primitive” just as you would use the name of a built-in primitive JXPL processor searches CLASSPATH for your primitive l l l Jeff Brown 18 11/21/2020
Application: OGSA-DAI DAI: Data Access and Integration l Special type of Grid service called Grid Data Service (GDS) l – Access to databases, relational and XML – Transformation of data (example: XSL) – Deliver data to a variety of sinks, such as Grid. FTP, file system, email, other GDS Jeff Brown 19 11/21/2020
GDS Scripts GDS is controlled by an OGSA-DAI XML script l OGSA-DAI scripting is not sophisticated enough to manage interaction between services l Some GDS scripts need to be created at runtime l Jeff Brown 20 11/21/2020
GDS Example GDS named source will query a database l GDS named sink will transform data l Source delivers its output to sink l OGSA-DAI uses common data format (Web. Row. Set) for service interaction. l Jeff Brown 21 11/21/2020
Managing GDS Interaction Use factory to create sink instance and store the handle of the instance l Run sink service in separate thread so that it can wait for data delivery l Create GDS script to control source service, incorporating handle of sink l Use factory to create source and submit script l Jeff Brown 22 11/21/2020
Managing GDS with JXPL A JXPL script can spawn a new thread for execution l JXPL programs can wait for JXPL code in another thread to finish l JXPL programs can create new scripts at runtime l Many languages could be used to manage GDS interaction, but JXPL can be created in the graphical Grid. Nexus environment l Jeff Brown 23 11/21/2020
Remote JXPL Processors Each JXPL processor has a URI l Processors can communicate with each other l A processor might send a script to a remote site for evaluation l Processors can get/set variables on remote processors l Jeff Brown 24 11/21/2020
JXPL URIs l ogsa: //152. 21. 222. 213/…/instance. Name – This uri is used by a JXPL processor whose evaluate method is exposed as a Grid service l rmi: //152. 21. 222. 213/Jxpl – This is the uri of a processor available through Remote Method Invocation (RMI) l socket: //152. 21. 222. 213: 1090/Jxpl – Uri of processor accessed via http Jeff Brown 25 11/21/2020
Jxpl. Symbol A symbol is the name of a JXPL variable l Symbols use XML namespaces to indicate the uri of processor where the data is stored l When a processor evaluates a symbol it checks the symbol’s namespace. If that namespace is different from it’s uri, it contacts the remote processor for the data. l Jeff Brown 26 11/21/2020
Symbol Example l l <symbol xmlns: fire=“rmi: //15. 0. 0. 1/Jxpl” name=“fire: foo bar”/> When a processor evaluates the symbol “foo bar” it contacts the remote processor. If a processor is directed to store data as that symbol, then it stores it on the remote processor. Sections of a JXPL script can be named in a similar fashion, indicating that they should be executed remotely. Jeff Brown 27 11/21/2020
Future Work: Primality Proving Given a large integer n, determine whether or not n is prime (cannot be factored in a nontrivial way) l Agrawal, Kayal and Saxena have recently proved that there is a polynomial-time algorithm for primality proving. l The AKS algorithm is readily parallelizable. l Jeff Brown 28 11/21/2020
MIRACL Multiprecision Integer and Rational C/C++ Library l Designed specifically for the type of work needed in AKS, and other cryptography applications. l Very efficient. l Jeff Brown 29 11/21/2020
AKS Algorithm The algorithm involves modular arithmetic on polynomials over a finite ring. l One polynomial must be raised to a very high power (n) and divided by another polynomial. l Repeated squaring and dividing. l Jeff Brown 30 11/21/2020
JXPL and MIRACL JXPL uses the Java Native Interface (JNI) to access MIRACL functions. l It is necessary to create shared libraries for the different platforms that the JXPL processor might run on (libmiracl. so, miracl. dll) l Jeff Brown 31 11/21/2020
Parallel AKS Start remote JXPL processors on machines in labs and classrooms on campus. l Run a JXPL script on one machine that divvies the work, sends it to remote processors and waits for the results. l Jeff Brown 32 11/21/2020
Summary JXPL is flexible enough for a variety of different tasks. l XML format makes it easy for programs to write JXPL scripts. l Designed for extensibility l Network aware l Grid. Nexus makes it possible for nonprogrammers to use JXPL. l Jeff Brown 33 11/21/2020
- Slides: 33