Class Nio2ModificationWatcher

  • All Implemented Interfaces:
    org.apache.wicket.util.watch.IModificationWatcher

    public class Nio2ModificationWatcher
    extends org.apache.wicket.util.watch.ModificationWatcher
    An extension of ModificationWatcher that removes the NotFound entries from the MarkupCache for newly created files. By default MarkupCache registers Markup.NO_MARKUP value for each requested but not found markup file. Later when the user creates the markup file the MarkupCache should be notified.
    Since:
    7.0.0
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.wicket.util.watch.ModificationWatcher

        org.apache.wicket.util.watch.ModificationWatcher.Entry
    • Constructor Summary

      Constructors 
      Constructor Description
      Nio2ModificationWatcher​(Application application, org.apache.wicket.util.time.Duration pollFrequency)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void checkCreated​(org.slf4j.Logger log)
      Checks for newly created files and folders.
      void destroy()  
      protected void entryCreated​(java.nio.file.Path path, org.slf4j.Logger log)
      A callback method called when a new Path entry is created
      protected void entryDeleted​(java.nio.file.Path path, org.slf4j.Logger log)
      A callback method called when a new Path entry is deleted
      protected void entryModified​(java.nio.file.Path path, org.slf4j.Logger log)
      A callback method called when a new Path entry is modified
      protected java.nio.file.WatchEvent.Kind[] getWatchedKinds​(java.nio.file.Path folder)  
      void start​(org.apache.wicket.util.time.Duration pollFrequency)  
      • Methods inherited from class org.apache.wicket.util.watch.ModificationWatcher

        add, checkModified, getEntries, remove
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Nio2ModificationWatcher

        public Nio2ModificationWatcher​(Application application,
                                       org.apache.wicket.util.time.Duration pollFrequency)
        Constructor.
        Parameters:
        application - The application that manages the caches
        pollFrequency - How often to check on IModifiables
    • Method Detail

      • start

        public void start​(org.apache.wicket.util.time.Duration pollFrequency)
        Specified by:
        start in interface org.apache.wicket.util.watch.IModificationWatcher
        Overrides:
        start in class org.apache.wicket.util.watch.ModificationWatcher
      • checkCreated

        protected void checkCreated​(org.slf4j.Logger log)
        Checks for newly created files and folders. New folders are registered to be watched. New files are removed from the MarkupCache because there could be Markup.NO_MARKUP (Not Found) entries for them already.
        Parameters:
        log - a logger that can be used to log the events
      • entryModified

        protected void entryModified​(java.nio.file.Path path,
                                     org.slf4j.Logger log)
        A callback method called when a new Path entry is modified
        Parameters:
        path - the modified path
        log - a logger that can be used to log the events
      • entryDeleted

        protected void entryDeleted​(java.nio.file.Path path,
                                    org.slf4j.Logger log)
        A callback method called when a new Path entry is deleted
        Parameters:
        path - the deleted path
        log - a logger that can be used to log the events
      • entryCreated

        protected void entryCreated​(java.nio.file.Path path,
                                    org.slf4j.Logger log)
        A callback method called when a new Path entry is created
        Parameters:
        path - the new path entry
        log - a logger that can be used to log the events
      • destroy

        public void destroy()
        Specified by:
        destroy in interface org.apache.wicket.util.watch.IModificationWatcher
        Overrides:
        destroy in class org.apache.wicket.util.watch.ModificationWatcher
      • getWatchedKinds

        protected java.nio.file.WatchEvent.Kind[] getWatchedKinds​(java.nio.file.Path folder)
        Parameters:
        folder - the folder that will be watched
        Returns:
        an array of watch event kinds to use for the watching of the given folder