--- 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]

Reply via email to