Auto Updating Problem.

0 views
Skip to first unread message

cyber

unread,
Feb 4, 2010, 10:17:47 PM2/4/10
to javatechnicals
I have created a POJO that extracts data from web.
I would like to sort the data and store it. - Right now I am storing
it in list. In future can be in a database, Its not a problem.

1)
I need to perform this extracting activity at periodic intervals since
I dont know when a site gets updated.
a) Do I create a POJO timer program that periodically fetches the
file, extracts the contents and store in database using Swing and just
the JSP and getters to read the data from database ?
b) Or it would be fine enough if I keep the POJO inside the webApp and
run it periodically.
Then Updation and deletion of both would be needed automatically.


2) In either of the cases, I need a single page displaying all the
extracted contents. As the updation to database is done
automatically,
a) would the autorefresh of my jsp page retreive new information of
all the contents from the database?
b) Or I will need to create a sendRedirect that makes a retreive call
to database to retreive all the latest details and get back to my main
page. I think 2a) would not work since it would be server side code
that is retreived once and only 2 b) is possible.

Effective Java

unread,
Feb 4, 2010, 11:06:43 PM2/4/10
to javatechnicals
For sorting pojos in the list you can use Collections.sort() method.
For that you have to implement Comparator or Comparable.

I think you can implement this by using and XmlHttpRequest(Ajax call).


Yes you need a scheduler for checking the the updated data for
particular interval.
The Best scheduler open source project is Quartz API

You can run the timer inside the web application there wont be a
problem for that.
You need not create a seperate applicaton for the timer.

Rejin Chandran

unread,
Feb 4, 2010, 11:13:04 PM2/4/10
to javatec...@googlegroups.com
Why dodn't u call a shellscript in cron and do this extracting  activity instead of using Timer class.

Effective Java

unread,
Feb 5, 2010, 3:39:34 AM2/5/10
to javatechnicals

Shell Script is only applicable for unix/linux OS. If he is using
Windows wht will do?

On Feb 5, 9:13 am, Rejin Chandran <reji...@gmail.com> wrote:
> Why dodn't u call a shellscript in cron and do this extracting  activity
> instead of using Timer class.
>

> > that is retreived once and only 2 b) is possible.- Hide quoted text -
>
> - Show quoted text -

Rejin Chandran

unread,
Feb 5, 2010, 3:55:12 AM2/5/10
to javatec...@googlegroups.com
no i just given an option. Since last few months i am working in linux i just want to inform that possibility also.

Rejin Chandran

unread,
Feb 5, 2010, 3:57:00 AM2/5/10
to javatec...@googlegroups.com
no i just given an option. Since last few months i am working in linux i just want to inform that possibility also.

If it is windows use bat script.

kalpit shukla

unread,
Feb 5, 2010, 2:43:07 PM2/5/10
to javatec...@googlegroups.com
:)

I think Quartz is a better option if it works cause you wont tell to deloy your application on a domain hosting server and tell him to run scripts...

Rejin Chandran

unread,
Feb 6, 2010, 12:32:58 PM2/6/10
to javatec...@googlegroups.com
this describes one of the advantages of java which we have studied in our classes

Platform Independent 



he he ;-)

Baiju Chandran

unread,
Feb 10, 2010, 3:17:38 AM2/10/10
to javatec...@googlegroups.com
for windows
Creating a Scheduled Task
like this
Go to Start > Programs > Accessories > System Tools > Scheduled Tasks
add a task written in a batch file or add an exe
Reply all
Reply to author
Forward
0 new messages