Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the design of a transaction processing system that supports the concurr

ID: 3638486 • Letter: C

Question

Consider the design of a transaction processing system that supports the concurrent updates of a common XML tree by multiple users. The preferred language is Java, but other languages are allowed with the permission from the instructor. Some sample code will be given to illustrate some of the basic techniques. Students can work in pairs (but not triples) or alone for the project with the same amount of work.
Part 1
You will implement the first version of the system that supports the following functionality:
1. A single user can create an XML tree from scratch with some graphical user
interface to show the tree.
2. A single user can load an XML tree and then insert a new leaf to the XML tree.
3. A single user can load an XML tree and then delete a leaf from the tree.

Explanation / Answer

import java.net.*; import java.io.*; import java.lang.reflect.*; public class MyLoader2 { public static void main (String argv[]) throws Exception { URLClassLoader loader = new URLClassLoader(new URL[] { new URL("http://www.javacourses.com/classes/") }); // Load class from class loader. argv[0] is the name of the class to be loaded Class c = loader.loadClass (argv[0]); Method m = c.getMethod("main", new Class[] {argv.getClass() }); m.setAccessible(true); int mods = m.getModifiers(); if(m.getReturnType() != void.class || !Modifier.isStatic(mods) || !Modifier.isPublic(mods)) { throw new NoSuchMethodException("main"); } try { m.invoke(null, new Object[] { argv }); } catch(IllegalAccessException e) { } } }