Normal Applications
-Mandelbrot Fractal-
(REFLECTOR)
Pojo Application Server
Coherent DiffusionŽ allows one to make an application run partly on client and partly on the server, instantly turning an application into a remote Rich client and a full server.
The developer can vary how heavy they want to make it on client or server, sometimes favoring a heavier client to take load away from the server and sometimes preferring a faster user response, through putting everything but the UI on the server.At the heavy client extreme, the application is delivered in full to the remote machine.
This example takes a Sun Swing sample (demonstrating Swing worker threads) of a Fractal, called a Mandelbrot and runs it with no modification, the original application is simply dropped into the Harbor repository.
Then to make it run... one makes a Wrapper application which calls the application's entry point, like this..
|
The reason for creating the little wrapper application is simply so we can provide an interface. This assumes we don't want to modify the original application.
This Wrapper application is then also dropped into the Harbor repository along with the original applications jars and libs.Now we make a simple Ship with this code in it...
| public void start(){ Class uiApp = vessel.getRemoteClass("kewlstuff.mandelbrot.wrapper.Wrapper"); if(uiApp != null){ I_Wrapper i_wrapper = (I_Wrapper)vessel.newInst(uiApp); i_wrapper.start(); } } |
Then one adds this to Ships in the same way as any other Ship...
That's it, we create a tiny dummy application that calls the entry point of the original application, and we start that from our remote Ship.
Harbor will deliver only the classes that are needed by the application to the remote machine. Its fast and efficient.Even when the application is not split with some remaining on the server, the efficiency of Harbor is remarkable, for example just the Mandelbrot Jar without its libraries is 132k, when Harbor delivers it, that reduces to 42k.
With Java and Harbor one never needs to use a tool like Flex, we have the convenience of using all the power of Java, and it flexes automatically, inside and outside a browser.To Test the Fractal
http://localhost:8080/harbor/ships/Mandelbrot_Ship.jar
and it will jump out of your browser
REFLECTOR
When one looks at the above code, its incredible to think that one is in effect installing and running a remote application, just with that code. Harbor has another trick up its sleeve, if one looks at the Reflector_Ship/App.props file, under ships, it shows one how to deliver full applications by just setting a few properties in a file. So no coding necessary to do this. The reflector sample also starts the Mandelbrot application, but it can start any application.
To Test the Reflector
http://localhost:8080/harbor/ships/Reflector_Ship.jar
and it will jump out of your browser
What's a Fractal...
We no experts in this area so forgive our cavalier treatment of this subject.
Its normally some fairly simple mathematics that has the characteristic of creating ever finer detail, and the patterns are truly strange and beautiful.
So when the application starts you see a big black "peanut", but if you zoom into the edges, you see more "peanuts" and some awesome patterns, and in theory you can zoom in at infinitum, so the other interesting thing is that when you zoom in so much that it starts to blur... its not ending, the machine's mathematical ability is reaching its limits.Such beautiful complexity results from simple mathematics, one cant help thinking that somehow lightning science and fractals are closely related, that somehow an electric storm is using simple mathematics to also decorate the sky with fractals.
All credit to the people on this site for this interesting application...
http://blogs.sun.com/swinger/entry/mandelbrot_update_with_new_fonts
Harbor Symbol