From: Arlindo da S. <da...@al...> - 2009-11-16 00:49:43
|
Hi Pedro, Sorry for the very long time, but I finally am able to get back to GrADSVM. I have now integrated the java code under the opengrads codebase, and updated the grads.class (built through nestedvm) to the latest grads 2.0.a7. I tried your your client/server code and it works as advertised. Very nice work, indeed. I have made some small alterations: 1) I preserved the previous monolithic JGrads.class. Therefore, I renamed the client class GVMclient. 2) I fixed a small bug in gxJ.java related to color definition. 3) I moved all non-nestedvm code to a separate Java/ directory. 4) Added targets to the Makefile to create grads.jar; renamed Makefile -> GNUmakefile to make it clear that GNU make is required. Here are the remaining issues: a) Would it be possible to add an option to "conn" to pass to the server, e.g., ga-> conn -l If omitted, the client could ask the user if portrait is desired. b) We need to capture the server's stdout and ship it back to the client. As we talked before, we could hijack gaprnt() and buffer the output on the java side and ship it back to the client upon finishing a command. Or else, one might be able to intercept stdout. Which one do you think is easier to do. (I can have gaprnt() calling a java function much like the gxJ functions.) c) The command printim now creates an image file on the server side. We need to find a way to ship this file back to the client. Can this be done byte-by-byte through the sockets? Another possibility would be to implement printim entirely in java as a screendump of the graphical canvas. (Are there built in methods for this?) d) Right now GrADSVM is a console application. Last year I was experimenting with a Console class, but it lacked jline support. Having a built in console one might be able to deploy the client through WebStart. Do you agree? BTW, you can find the revised jar (including sources) here: http://opengrads.org/devel/java/ or you can get the full sources from cvs: % gacvs co -P grads See the Java/ directory. To build the nestedvm code you need a Mac, or else you need to build the nestedvm toolchain yourself for other platorms. The nestedvm compiled supplibs should be portable. GVMclient/server can be run from the jar, e.g., % java -cp ./grads.jar GVMserver % java -cp ./grads.jar GVMclient I think we are very close to have something for an early release to the community. What do you think? Cheers! Arlindo On Mon, Mar 2, 2009 at 2:47 AM, pedro tsai <ped...@ya...> wrote: > hi Arlindo, > > Attached is GradsVM client/server code. Un-tar the files into your working > directory where the other NestVM generated code/data are located. So far, > I have not yet touch NestVM generated files, I just add new code in the > same top-level directory where original NestVM files are. > > 1. To compile the code, type 'make'. To list all the new files, type > 'make info'. > > 2. To run, you need 2 windows (one for client process, one for > GradsVM process) > > on the client window, type 'make run' > > on the server window, type 'make svc' > > once the system running, the first command to type on client's side > readline input is > > 'conn' /* by default, it will use IP 127.0.0.1, and port 6789 > and 6790. If these ports are used on your system, you can change > them (in SockIPC.java) and then re-compile. I use 2 ports, one for > > 'gacmd' communication and one for 'graphics primitives' > communication. > > If you want to run GradsVM on remote host, type > > 'conn ip-addr' > > Once the connection is establish, you should see output on the > 'server side' window. You need to hit a 'Return' on the server > side window, otherwish the gradsVM thread is blocking after the > initial Grads information display ('Landscape mode ('n' ...) > > Now you can enter 'grads' command, then they should be executed > by GradsVM. > > To exit the client, type 'quit', this will disconnect and kill > the client process. You can start a new client process again > to connect to GradVM server. I did not have 'disconnect' command > implement, but it is not hard to do. > > 3. The naming convention for the files is: the server side code starts > with > 'GVM...'. The client side code starts with 'JG...'. Files that do not > have either prefixs are utility code or are used by both (like > SockIPC.java) > > 4. You can have more than 1 client connect to the server, each client > will get its own GradsVM, but right now there is bug, so I think it will > dead-lock the gradsVM. > > 5. There are other issues, for example, the command line argument on > the client side is not pass to the GradsVM, this is easy to fix. And > also, > the information test from GradsVM is not sent back to client. (e.g, q file, > q dim....). > > If you can not run the prototype, let me know. > I think there is still a lots of work to refine this...... > > Pedro > > > -- Arlindo da Silva da...@al... |