If you still need a general scheduling solution, or the suggestion(s) below
won't work, perhaps you could investigate using Quartz and configuring it
within your
container (Spring is handy for this).
http://www.opensymphony.com/quartz/
Article on others using it:
http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21288885.html
(scroll to bottom)
I've used Quartz / Spring very successfully for scheduled (cron) jobs. It
takes cron-formatted strings for scheduling. I haven't used it within the
Servlet container, but I'd imagine it should work just as well.
Jeremy Thomerson
----- Original Message -----
From: "Wade Chandler" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Monday, December 26, 2005 9:15 PM
Subject: Re: detecting a new file
--- Khawaja Shams <[EMAIL PROTECTED]> wrote:
Hello all,
I am curious if anyone has ever had to write a
servlet that listens for
new files on the server and processes them upon
appearence. Basically, I
need to write a server side program that detects
when (our automated
process) delivers a file to the server filesystem
and then process the
file. I would sincerely appreciate any pointers on
how this can be
accomplished from within tomcat.
Happy Holidays.
Sincerely,
Khawaja Shams
My theory is always copy something that is working
now. Go to www.netbeans.org,download a source zip as
available here
(http://www.netbeans.info/downloads/download.php?a=n&p=2)
... maybe choose a daily build ... keep following the
arrows eventually you'll get to the download and be
able to select a source download...that or figure out
how to use their CVS repository, and then follow the
source directory structure to the directory (relative
obviously):
openide\fs\src\org\openide\filesystems
see the files:
FileChangeListener.java
FileChangeAdapter.java
FileEvent.java
AbstractFolder.java (this actually has the code to
watch the directory)
also the tomcat code watches directory contents and
files as well. I don't know exactly where, but you'll
be looking for code that watches the webapps directory
for .war files and possibly other files. Auto-deploy
of war files works this way.
Anyways, all you're doing is watching a directory for
files and storing previous states so you can compare
later to see what has happened. You could store state
in a DB and use SQL to determine changes or store it
in memory. This will all depend on what you need ...
speed vs. memory usage. SQL and connections obviously
slower than an in memory map, but it should save you
on always keeping your memory used.
Hope it helps,
Wade
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]