Interface PageProvider

  • All Superinterfaces:
    WikiProvider
    All Known Implementing Classes:
    AbstractFileProvider, CachingProvider, FileSystemProvider, VersioningFileProvider, WikiPageAdapterProvider

    public interface PageProvider
    extends WikiProvider
    Each Wiki page provider should implement this interface.

    You can build whatever page providers based on this, just leave the unused methods do something useful.

    WikiPageProvider uses Strings and ints to refer to pages. This may be a bit odd, since WikiAttachmentProviders all use Attachment instead of name/version. We will perhaps modify these in the future. In the mean time, name/version is quite sufficient.

    FIXME: In reality we should have an AbstractWikiPageProvider, which would provide intelligent backups for subclasses.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void deletePage​(java.lang.String pageName)
      Removes an entire page from the repository.
      void deleteVersion​(java.lang.String pageName, int version)
      Removes a specific version from the repository.
      java.util.Collection<SearchResult> findPages​(QueryItem[] query)
      Finds pages based on the query.
      java.util.Collection<Page> getAllChangedSince​(java.util.Date date)
      Gets a list of recent changes.
      java.util.Collection<Page> getAllPages()
      Returns all pages.
      int getPageCount()
      Gets the number of pages.
      Page getPageInfo​(java.lang.String page, int version)
      Returns info about the page.
      java.lang.String getPageText​(java.lang.String page, int version)
      Gets a specific version out of the repository.
      java.util.List<Page> getVersionHistory​(java.lang.String page)
      Returns version history.
      void movePage​(java.lang.String from, java.lang.String to)
      Move a page
      boolean pageExists​(java.lang.String page)
      Return true, if page exists.
      boolean pageExists​(java.lang.String page, int version)
      Return true, if page with a particular version exists.
      void putPageText​(Page page, java.lang.String text)
      Attempts to save the page text for page "page".
    • Method Detail

      • putPageText

        void putPageText​(Page page,
                         java.lang.String text)
                  throws ProviderException
        Attempts to save the page text for page "page". Note that the provider creates a new version regardless of what the version parameter of the WikiPage is.
        Parameters:
        page - The WikiPage to save
        text - The text to save.
        Throws:
        ProviderException - If something goes wrong.
      • pageExists

        boolean pageExists​(java.lang.String page)
        Return true, if page exists.
        Parameters:
        page - The page name.
        Returns:
        true, if the page exists; false otherwise.
      • pageExists

        boolean pageExists​(java.lang.String page,
                           int version)
        Return true, if page with a particular version exists.
        Parameters:
        page - The page name to check for
        version - The version to check
        Returns:
        True, if page exists; false otherwise.
      • findPages

        java.util.Collection<SearchResultfindPages​(QueryItem[] query)
        Finds pages based on the query. Only applicable to providers which implement the FastSearch interface. Otherwise JSPWiki will use its internal cache.

        This method should really be a part of the FastSearch IF.

        Parameters:
        query - An array of QueryItems to match
        Returns:
        A Collection of WikiPages.
      • getPageInfo

        Page getPageInfo​(java.lang.String page,
                         int version)
                  throws ProviderException
        Returns info about the page.
        Parameters:
        page - The page name
        version - The version number
        Returns:
        A filled WikiPage.
        Throws:
        ProviderException - If something goes wrong.
      • getAllPages

        java.util.Collection<PagegetAllPages()
                                        throws ProviderException
        Returns all pages. Each element in the returned Collection should be a WikiPage.
        Returns:
        A collection of WikiPages
        Throws:
        ProviderException - If something goes wrong.
      • getAllChangedSince

        java.util.Collection<PagegetAllChangedSince​(java.util.Date date)
        Gets a list of recent changes.
        Parameters:
        date - The date to check from
        Returns:
        A Collection of WikiPages
        Since:
        1.6.4
      • getVersionHistory

        java.util.List<PagegetVersionHistory​(java.lang.String page)
                                        throws ProviderException
        Returns version history. Each element should be a WikiPage.
        Parameters:
        page - The name of the page to get the history from.
        Returns:
        A collection of WikiPages.
        Throws:
        ProviderException - If something goes wrong.
      • getPageText

        java.lang.String getPageText​(java.lang.String page,
                                     int version)
                              throws ProviderException
        Gets a specific version out of the repository.
        Parameters:
        page - Name of the page to fetch.
        version - Version of the page to fetch.
        Returns:
        The content of the page, or null, if the page does not exist.
        Throws:
        ProviderException - If something goes wrong.
      • deleteVersion

        void deleteVersion​(java.lang.String pageName,
                           int version)
                    throws ProviderException
        Removes a specific version from the repository. The implementations should really do no more security checks, since that is the domain of the PageManager. Just delete it as efficiently as you can.
        Parameters:
        pageName - Name of the page to be removed.
        version - Version of the page to be removed. May be LATEST_VERSION.
        Throws:
        ProviderException - If the page cannot be removed for some reason.
        Since:
        2.0.17.
      • deletePage

        void deletePage​(java.lang.String pageName)
                 throws ProviderException
        Removes an entire page from the repository. The implementations should really do no more security checks, since that is the domain of the PageManager. Just delete it as efficiently as you can. You should also delete any auxiliary files that belong to this page, IF they were created by this provider.

        The reason why this is named differently from deleteVersion() (logically, this method should be an overloaded version) is that I want to be absolutely sure I don't accidentally use the wrong method. With overloading something like that happens sometimes...

        Parameters:
        pageName - Name of the page to be removed completely.
        Throws:
        ProviderException - If the page could not be removed for some reason.
        Since:
        2.0.17.
      • movePage

        void movePage​(java.lang.String from,
                      java.lang.String to)
               throws ProviderException
        Move a page
        Parameters:
        from - Name of the page to move.
        to - New name of the page.
        Throws:
        ProviderException - If the page could not be moved for some reason.