开发者

Problems with deployment, advice needed for a web-based java application

I have developed a command-line (read: no GUI) Java application which crunches through numbers based on a given dataset and a series of parameters; and spits out a series of HTML files as resultant reports. These reports hold a large amount of data in tables, so in order to give the users a easy and quick overview of the results, I utilized the JUNG2 library and created a nice graph.

Here's where it gets interesting; since I would like the graph to be interactive it should be deployed after the application has run and files are generated, whenever the user wants to view the reports. I decided to go with an applet based deployment, however I am not too happy with the current setup due to the following reasons:

  1. I want to make the software as simple to use as possible (my users won't be tech-savvy, and even tech-intimidated in most cases). I would re开发者_运维问答ally like to distribute one JAR only, which forced me to put the applet with everything else it needs in a package in the same JAR as the main application.

  2. The applet and the main application need to communicate the results, so I create a xML-based report which is used to hold information. As long as the files are on a local machine and are not moved around it all works fine. Unfortunately I also need the files to be moved around. A user should be able to take the "results" folder to a USB stick, go anywhere plug the stick to another computer and be able to use the report as he/she likes.

For the time being the applets are implemented with the following html code:

<applet code="package.myapp.visualization.GraphApplet.class" 
        codebase="file:/home/user/myApp" 
        archive="myApp-0.2.6-r28.jar" 
        width="750" height="750">
    <param name=input value="results/test_name/results.fxml">
</applet>

As you can see this applet will not work if the parent folder is moved to another location.


As far as I know I have a couple of alternatives:

a) Change codebase to point to an URL on our webserver where I could put the jar file. This however creates the problem with permissions, as the applet will not be able to read the results file. Alternative is to upload the results file to the server when the user wants to visualize the graph, although I am not sure if that's a good option due to server security and also if it could be made so that upload happens automatically without bothering the user.

b) I can use a relative path on the codebase attribute, but then the whole folder hierarchy needs to be intact upon copy. This could be a last resort, if I cant come up with a better way to do it.

c) change the deployment method (would like to avoid this alternative to not spend more time on the development phase)

Any ideas? Am I missing something? How could I tackle this problem? Thanks,


I'm not sure I entirely understand your use-case, but from what I do understand, I would suggest this:

Dump the applet for an application launched using Java Web Start. Have the JNLP file declare a file association for the fxml file type. When the user double clicks an fxml file, it will be passed as an argument to the main(String[]) of the JWS application.

A sand-boxed JWS application can gain access to resources on the local file system using the JNLP API. Here is my demo. of the JNLP API file services.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜