You have to instantiate the ActiveMonitor Component:
ActiveMonitor monitor = new ActiveMonitor();
monitor.setLogger(logger);
monitor.configure(new Configuration()); // the
defaults
// are every
// minute
monitor.start()
Resource resource = new FileResource( "test.file" );
resource.addPropertyChangeListener( listener );
monitor.addResource( resource );
// add code to modify the file.
// The PropertyChangeListener you added should
// catch the "last-modified" property
monitor.removeResource( resource );
resource.removeAllPropertyChangeListeners();
monitor.stop();
I'll leave the rest for you to work out.
--- Laran Coates <[EMAIL PROTECTED]> wrote:
> OK, first time I've done this so one question.
>
> I wrote something to test the FileResource and
> ActiveMonitor. What's the
> "proper" way to make it available?
>
> -----Original Message-----
> From: Berin Loritsch [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 15, 2001 3:26 PM
> To: Avalon Development
> Subject: Re: New Monitor framework
>
>
> Berin Loritsch wrote:
> >
> > Laran Coates wrote:
> > >
> > > Well explained. Sounds brilliant. I'm all in
> favor. Let me know how
> if I
> > > can help.
> >
> > Sure thing. I can use test cases, and the
> FileResource and JarResource
> implementations
> > written. I am rapidly running out of spare time
> here. The first (albeit
> untested
> > cut is in CVS now).
>
>
> Ok, initial implementations are in CVS now. We need
> testing to make sure it
> actually
> works :), but I have a feeling it won't take much to
> get it going.
>
> In order to be notified of a resource modification,
> you must implement the
> java.beans.PropertyChangeListener interface, and
> register yourself with the
> Resource.
>
> If you use the FileResource to obtain a stream or
> writer for the resource,
> it will
> automatically perform the notifications when the
> stream is closed.
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
>
_________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at
> http://mail.yahoo.com
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]