[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] [prov] directory watcher

can you point out a precise problem?  I had used an older version of the JDT UI prefs template (I've now updated the project) but organizing imports on the code did not change anything (ie.., they were properly organized).


Pascal Rapicault/Ottawa/IBM@IBMCA
Sent by: equinox-dev-bounces@xxxxxxxxxxx

08/30/2007 09:50 AM

Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>

Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
Re: [equinox-dev] [prov] directory watcher

Please make sure to properly set the "organization of imports" for this
project :-)


 From:       Jeff McAffer/Ottawa/IBM@IBMCA                                                                        
 To:         Equinox development mailing list <equinox-dev@xxxxxxxxxxx>                                            
 Date:       08/30/2007 08:58 AM                                                                                  
 Subject:    Re: [equinox-dev] [prov] directory watcher                                                            

For the most part the DirectoryWatcher is very similar to what Peter did
originally.  That is, it just polls using a configurable delay.  It
certainly could be extended to hook the filesystem to get change
notifications.  We have all the required infrastructure in the resources
plugins so it should be relatively easy.

The DirectoryWatcher also notices changes (based on File.lastModified())
and file deletions.  The "JARListener" translates file timestamp changes
into BundleContext.update() and file deletions into
BundleContext.uninstall().  In some cases a file might be locked (e.g., if
you installed a bundle by reference: and a classloader has it open).  In
that case you can "virtually delete" the file by adding a sibling file of
the same name but with ".del" appended.  The DirectoryWatcher will notice
this and process the base file (the one without .del) as though it had been
removed (e.g., the corresponding bundle would be uninstalled).  Then, at
the end of each polling cycle the DirectoryWatcher attempts to delete all
"virtually deleted" base files as well as the corresponding delete marker
files (.del files).  I'm sure there are holes in the actual implementation
but initial testing shows that it works quite handily.

Some notes:
- currently bundles are installed using standard OSGi installBundle().
That is, they are not installed by reference so you end up with two copies
of the bundle on disk.  Worse, you get one copy per configuration that used
this technique.   We should look at having an option to install by
- The real intention is to have this be a replacement for Update Manager's
promiscuous install behaviour.  People have grown quite used to dropping
some files in the plugins dir and having them show up in Eclipse on next
run.   With p2 that will not happen natively.  With the DirectoryWatcher
and a p2 listener, users should be able to identify as many directories as
they want and have bundles added and removed from them *dynamically*
installed/uninstalled/updated.  So in the end users get enhanced


"Alex Blewitt"                                                            
Sent by:                                                               To
equinox-dev-bounces@xxxxxxxxxxx          "Equinox development mailing    
                                         list" <equinox-dev@xxxxxxxxxxx>  
08/30/2007 03:58 AM                                                      
                                         Re: [equinox-dev] [prov]        
        Please respond to                directory watcher                
 Equinox development mailing list                                        

Interesting. Does it periodically scan for changes, or does it hook in
with the underlying file system notifications to receive changes? I
believe that the Win32 resources API has the ability to pick up
changes; it would be good if that worked for other systems too.

Does it do the reverse, uninstalling a bundle if the corresponding
file is deleted?


On 30/08/2007, Jeff McAffer <Jeff_McAffer@xxxxxxxxxx> wrote:
> I finally did something that has been on my list for quite some time.
>  Inspired by Peter Kriens' FileInstall bundle, I made a DirectoryWatcher
> that, as the name implies, watches a directory and installs, uninstalls,
> configures, ... things that are dropped into/removed from/changed in the
> dir.  The current working support directly calls installBundle() etc but
> have also been working on one that calls p2 API to effect and install.
> design consists of a DirectoryWatcher with which you can register
>  The listeners then get added, removed and changed events for the files
> interest in the directory being watched.  It is quite easy to create a
> listener that does your own thing.
> Keeping in mind that this is quite early, take a look at
>         org.eclipse.equinox.p2.directorywatcher
> I have added not this to the PSF files yet as there are some compile
> in the provisioning listener as I have not completed enhancing the
> generator to work on individual files rather than directories.  More to
> later...
> Jeff
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/equinox-dev
equinox-dev mailing list
equinox-dev mailing list

equinox-dev mailing list