File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Online offline solution in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Online offline solution in Java" Watch "Online offline solution in Java" New topic

Online offline solution in Java

Abhijeet Vaidya

Joined: Apr 16, 2007
Posts: 20

I am looking for a java based solution for an application with online/offline capabilities. User should be able to work offline (client) and when he comes online on company network, he should be able to send data to the server.

Also need a functionality to send data from server to client. What all APIs can be used?

Can JMS be one solution?

Any suggestions are welcome.

Thank you.
Sachin Joshi
Ranch Hand

Joined: Aug 06, 2008
Posts: 83

You may want to develop standalone java application thick client which provides the user a way of saving the work done in local machine then when user choses to go online the saved work can be synchronized over network. This could be done over HTTP or network layer also.

What is the offline work user is going to do? Is it something like outlook mail client ?

Web Development Tips and Tutorials - By Sachin
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
I think it's advisable to separate the two parts - saving offline to work for later synchronization, and actually sending it to the server later.

Saving could take any number of forms, depending on the data (or Java objects) you need to store. One of the easiest is probably to use serialization, either of the javax.xml.XMLEncoder shape if the objects are JavaBeans, or of the binary variety (using ObjectOutputStream) if they are not. You could also use a flat file if the data items are simple.

As to sending the data to the server, all kinds of routes are possible: email, JMS, HTTP, sockets, web services... It depends on what the server supports, and makes sense for the data in question. Email and JMS send unformatted data, so the server would need to interpret/parse it in some fashion. HTTP allows to send name/value pairs, which is a step up. Web services have a notion of data types, so that's at an even higher level. Without knowing anything about the application in question, I'd probably go with an HTTP or web service solution.

One issue you need to think about is synchronization. After the user's last server access the data on the server may have changed, which could impact whether the changes the user is about to upload are still valid, or whether they should be rejected. It's possible that your application doesn't need to worry about that, though.
I agree. Here's the link:
subject: Online offline solution in Java
jQuery in Action, 3rd edition