@header@
Blog Listeners

Blog listeners are a type of Pebble plugin that allow you to write code that is called whenever your blog is started and stopped. Example uses include:

  • Initialising/flushing a cache when the blog is started/stopped.
  • Opening/closing a connection to an external data source that is used by another type of Pebble plugin.
  • Starting/stopping a thread that subscribes to an RSS feed and automatically posts new content to your blog.

To write your own listener, you need to write a Java class that implements the pebble.event.blog.BlogListener interface as shown below. To gain access to the associated blog, simply use the getBlog() method on the pebble.event.blog.BlogEvent object that is passed to the callback methods.

  package pebble.event;

  /**
   * Implemented by classes wanting to be notified of blog events.
   *
   * @author Simon Brown
   */
  public interface BlogListener {

    /**
     * Called when a blog has been started.
     *
     * @param event   a BlogEvent instance
     */
    public void blogStarted(BlogEvent event);

    /**
     * Called when a blog has been stopped.
     *
     * @param event   a BlogEvent instance
     */
    public void blogStopped(BlogEvent event);

  }

@footer@