views:

84

answers:

3

For my final year project I plan to code a cloud in Python. The client will be written in Java by the other member of my team. The client will have a tabbed interface and it will provide a text editor, a media player, a couple of small Java based games and a maybe a few more services.

The server will work like this:

1) Validate the user.

2) Send a file, called "dump" to the user. Dump will contain all the file names and file types that the user created by himself or the files which the user can read/write. This info will be fetched from the database.

3) The tabs in the client will display the file types associated with the tab application. e.g the media tab will only select and show the media files from the dump readable by user. The text editor tab will show only the txt files from the dump readable by the user.

4) A request to open the file will send the file back to client, which the associated application will open.

5) All the changes made to the files and all the actions (overwriting, saving, deleting etc.) will be sent back to the server along with the new object. Something similar will be done to the newly created objects.

My Questions are:

What are the best approaches for the communication between the client and the server. For the dump I plan to use some sort of encrypted XML file. For the other way round, I don't have a clue :/.

For easy integration with the database, I was planning to use Django (which I started few days back). How can I send my requests from the client to the server (without Django I'd use SQL queries) and the files from the server to the client? Maybe GET and POST will work for the former problem? Any other suggestions?

A: 

If you're going to use a web framework on the server, it makes sense to use an HTTP-based protocol. The downside is that only the client can initiate a connection (e.g., the client needs to first ask for the "dump" file), but a simple GET request will suffice (remember, the server can send anything in the HTTP response, including your XML file).

Regarding encryption, it's best to use an existing protocol like HTTPS. There are well-vetted libraries that will correctly establish a secure connection between your client and the server.

Overall, I'm advocating the highest-level protocols that are appropriate for your application. HTTP(S) goes hand-in-hand with your web-based architecture, so make use of it.

ide
A: 

Stick to Django. It's really productive. I would use JSON instead of XML. More convenient. import json. This should help you in communicating between client-server.

Also cloud computing is just a recent word that's just thrown around for (client+server+some services). Oh by the way all that you want to do can be completely done in Django itself. No need to go to JAVA.

Django is Cool :)

MovieYoda
Offtopic: The teachers think of cloud computing as something big, but its a nice example of ontogeny recapitulates phylogeny.Ontopic: I have to have a client and since no one in the team knows Javascript, the browser cannot be the client which leaves Java as the only option.
tushartyagi
MovieYoda
MovieYoda
@movieyoda: Well that's what I'm talking about; I would love to use Javascript but I am trying to design the server and my team-mates know nothing about Javascript :-/ And I don't have the rep to vote up the answers :)
tushartyagi
@movieyoda: And besides that, playing media files in JS will be too difficult and complex for us. Flash might come to rescue but that's something I don't want to dig into.
tushartyagi
A: 

Q1: how should I transfer data between client/server securely

A: HTTPS to support encryption & JSON to serialise objects between languages (Python/Java) seems to be the most natural. You could experiment with XML-RPC over SSL or TSL if you want to be creative.

Q2: How do I send queries to the server's db?

A: My first response is to say talk to the person coding the server, and see what's easiest on that end. However, I think that your client should stick to HTTP. The server developer would ensure the server supports RESTful URIs. Then your client only access a URI and have the results processed by the server.

At its most raw, this could be implemented like this:

https://www.example.com/db?q="SELECT * FROM docs"

There are smarter ways to do it, but you get the idea.

Tim McNamara
Well I'd be coding the server. Queries to db would be handled by django's urls and views. So, are GET and POST the best options here?
tushartyagi