Ejemplo n.º 1
0
    /**
     * Inspect wiki events for shutdown.
     *
     * @param event The wiki event to inspect.
     */
    public void actionPerformed(WikiEvent event) {

      if (event instanceof WikiEngineEvent) {
        if (event.getType() == WikiEngineEvent.SHUTDOWN) {

          log.info("actionPerformed: Detected wiki engine shutdown");
          handleShutdown();
        }
      }
    }
Ejemplo n.º 2
0
  /**
   * Flushes the document cache in response to a POST_SAVE_BEGIN event.
   *
   * @see
   *     com.ecyrd.jspwiki.event.WikiEventListener#actionPerformed(com.ecyrd.jspwiki.event.WikiEvent)
   */
  public void actionPerformed(WikiEvent event) {
    if ((event instanceof WikiPageEvent) && (event.getType() == WikiPageEvent.POST_SAVE_BEGIN)) {
      if (m_documentCache != null) {
        String pageName = ((WikiPageEvent) event).getPageName();
        m_documentCache.flushPattern(pageName);
        Set referringPages = m_engine.getReferenceManager().findReferredBy(pageName);

        //
        //  Flush also those pages that refer to this page (if an nonexistant page
        //  appears; we need to flush the HTML that refers to the now-existant page
        //
        if (referringPages != null) {
          Iterator i = referringPages.iterator();
          while (i.hasNext()) {
            String page = (String) i.next();
            log.debug("Flushing " + page);
            m_documentCache.flushPattern(page);
          }
        }
      }
    }
  }