wood burning stoves 2.0*
The moose likes Applets and the fly likes better design for applet in 2 phases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "better design for applet in 2 phases" Watch "better design for applet in 2 phases" New topic
Author

better design for applet in 2 phases

Yahya Elyasse
Ranch Hand

Joined: Jul 07, 2005
Posts: 510

Hi,
a client asked me to write two applets :
first applet will need to select some local files and saves there full paths into a text file .
in a 3rd phase this text file will be passed to a second applet to dowork with each file in the list.

the need to split this into 2 applets is that we will have an intermediate 2nd phase where user will need to do some payment processing etc.if he/she passes payment phase he/she will be redirected to second applet to work with files list saved in text file from 1st applet.

do you think using a text file to save file paths and pass it to second applet is a good solution?
is there any other clean and elegant solution to pass a list of local files path to a second applet later in another phase .(2 applets won't probably communicate directly b/c there will an intermediary phase a php script )

thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
Since you're specifically separating the gathering of the file list from the processing, with the payment in between, I assume that the payment depends on the number and/or contents of the files? If so, it might be better to keep the data someplace where it's not easily changeable by the user. Since the applet needs to be signed anyway, you could use the Preferences API (java.util.prefs) for this. You might also want to think about encrypting the file contents.

Alternatively, the first applet could calculate a hash of the file, stor eit on the server, and the second applet would check it to make sure that the file contents haven't been tampered with.


Ping & DNS - updated with new look and Ping home screen widget
Yahya Elyasse
Ranch Hand

Joined: Jul 07, 2005
Posts: 510

Originally posted by Ulf Dittmer:
Since you're specifically separating the gathering of the file list from the processing, with the payment in between, I assume that the payment depends on the number and/or contents of the files? If so, it might be better to keep the data someplace where it's not easily changeable by the user. Since the applet needs to be signed anyway, you could use the Preferences API (java.util.prefs) for this. You might also want to think about encrypting the file contents.

Alternatively, the first applet could calculate a hash of the file, stor eit on the server, and the second applet would check it to make sure that the file contents haven't been tampered with.


Thank you for interesting reply.
I suppose my client won't opt for using a database (like mysql).if we could use a database to store the files list that would be a good solution. what you think ?

I liked the Idea of using java.util.Preferences and would maybe try to use it. if user stores file list with Preferences mechanism can this file list be accessible from both client applets and server side web pages ?
if my client insists on using a plain text file to store the paths , where you think the better place to save this file ? (i don't think saving it in user local drive is a good idea .I'll be trying to convince the client of this fact).
thank you
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
There are several question; i'll just go into each briefly. It's hard to advise what might be good options because you don't mention why you need this 2 step process.

I suppose my client won't opt for using a database (like mysql).if we could use a database to store the files list that would be a good solution. what you think ?

A database doesn't sound like a good idea - lots of overhead for installing and maintaining it, just to store very little information.

if user stores file list with Preferences mechanism can this file list be accessible from both client applets and server side web pages ?

Nothing you do on the client will be accessible from the server. If the client generates data that the server side needs, then you need to transfer it to the server.

How about not storing the list of files on the client (since apparently you don't trust the client), but saving it on the server using HTTP?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: better design for applet in 2 phases
 
Similar Threads
ur opinion on this...
security?
Applet works fine in my Eclipse IDE, but doesn't work outside of Eclipse
what is the best method to sort strings in real time or off line ?
JavaFX Script