• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Direction needed to connect the desktop app to the cloud

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Java desktop application which stores data into a SQLite db every 10 mins which is stored locally in the user's system. I have a cloud interface to visualize this data which uses PHP and MySQL.

I need to fetch data from the local db of the users. I don't know how to go forward with this. What technologies to use so that the local data in the user's system is not exposed to the web but is somehow made available to the cloud interface to visualize it.

Can you please tell me what technologies to go with and the whole process of data interchange? I am a bit confused with this.
 
Ranch Hand
Posts: 199
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just guessing,
but you could replicate the client local data to the cloud every X minutes with a client task?

For example a rest/ws/json call from the client to a rest/ws/json php service in the server.

Best regards
 
Dan Foster
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
im not sure how to do this. So what you are saying is that the data stored in the local machine would be pushed to the cloud every X minutes ?
This is what i want but im not sure how to do this? what technologies ?
 
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nice idea Carles. Very similar to mobile device with floating Internet connection. It saves all the data to local DB, and when connection is available sends a bunch of messages to the server.

Dan Foster wrote:how to do this? what technologies ?


You need to call OS specific scheduling service (Task on Win32, Cron on Unix), or use Java scheduling framework which will make the call under the hood.
For example: Quartz.
 
Dan Foster
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So here is what i understand. Please correct me if this is wrong -

Components -
1) My desktop application runs every X minutes and inserts the data into the db.
2) Cloud app which would visualize this data every X minutes.

Every time data is inserted into db, a servlet(since desktop app is in Java) runs and sends a json string to the cloud app. Now the cloud app parses this string and gets data to visualize
or
Every time data is inserted into db, a servlet(since desktop app is in Java) runs and saves the data in the cloud app db. Now the cloud app reads its own db and visualizes.

 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dan,

What about

1. Every X insertions in your client desktop db (SQL Lite) or T time, your client app sends a json string, with this data new data,
to a json service in the server via Apache HttpClient or Jersey API.
2. Your json service in the server implemented with php, parses the data and insert this new data to the mysql db.
3. Visualize the data in your mysql through some php page in your server



 
Dan Foster
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya, this looks good. Thanks Carles.

So in order to implement this -
1) I will have to make a JSON string using the Jersey API.
2) JSON service in the cloud app using PHP which parses the JSON string and stores in the mysql db.

Does this mean i have to write a web service of some kind?
Don't I have to write some servlets or just using the Jersey API will suffice ? Can you suggest some good tutorial or book where the process would be explained well ?
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dan Foster wrote:
1) I will have to make a JSON string using the Jersey API.


You could also employ JAXB to bind JSON to Java objects.
 
Dan Foster
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now i am sending the JSON string using POST via HTTPURLConnection. But how to accept that JSON string using PHP ?
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dan Foster wrote:...how to accept that JSON string using PHP ?


You need to read the string from HTTP request on PHP side and parse it with some library. However that is not java related question.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic