Interface WikiAttachmentProvider

All Superinterfaces:
org.apache.wiki.api.providers.WikiProvider, WikiProvider

Deprecated.
use AttachmentProvider instead
Defines an attachment provider - a class which is capable of saving binary data as attachments.

The difference between this class and WikiPageProvider is that there PageProviders handle Unicode text, whereas we handle binary data. While there are quite a lot of similarities in how we handle things, many providers can really use just one. In addition, since binary files can be really large, we rely on Input/OutputStreams.

See Also:
  • AttachmentProvider
  • Field Summary

    Fields inherited from interface org.apache.wiki.api.providers.WikiProvider

    LATEST_VERSION
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deleteAttachment(org.apache.wiki.attachment.Attachment att)
    Deprecated.
    Removes an entire page from the repository.
    void
    deleteVersion(org.apache.wiki.attachment.Attachment att)
    Deprecated.
    Removes a specific version from the repository.
    Collection<org.apache.wiki.attachment.Attachment>
    findAttachments(org.apache.wiki.search.QueryItem[] query)
    Deprecated.
    Finds attachments based on the query.
    getAttachmentData(org.apache.wiki.attachment.Attachment att)
    Deprecated.
    Get attachment data.
    org.apache.wiki.attachment.Attachment
    getAttachmentInfo(org.apache.wiki.WikiPage page, String name, int version)
    Deprecated.
    Returns info about an attachment.
    List<org.apache.wiki.attachment.Attachment>
    getVersionHistory(org.apache.wiki.attachment.Attachment att)
    Deprecated.
    Returns version history.
    List<org.apache.wiki.attachment.Attachment>
    listAllChanged(Date timestamp)
    Deprecated.
    Lists changed attachments since given date.
    List<org.apache.wiki.attachment.Attachment>
    listAttachments(org.apache.wiki.WikiPage page)
    Deprecated.
    Lists all attachments attached to a page.
    void
    moveAttachmentsForPage(String oldParent, String newParent)
    Deprecated.
    Move all the attachments for a given page so that they are attached to a new page.
    void
    putAttachmentData(org.apache.wiki.attachment.Attachment att, InputStream data)
    Deprecated.
    Put new attachment data.

    Methods inherited from interface org.apache.wiki.api.providers.WikiProvider

    getProviderInfo

    Methods inherited from interface org.apache.wiki.WikiProvider

    initialize, initialize
  • Method Details

    • putAttachmentData

      void putAttachmentData(org.apache.wiki.attachment.Attachment att, InputStream data) throws org.apache.wiki.api.exceptions.ProviderException, IOException
      Deprecated.
      Put new attachment data.
      Parameters:
      att - Attachment object to add new data to
      data - The stream from which the provider should read the data
      Throws:
      IOException - If writing fails
      org.apache.wiki.api.exceptions.ProviderException - If there are other errors.
    • getAttachmentData

      InputStream getAttachmentData(org.apache.wiki.attachment.Attachment att) throws org.apache.wiki.api.exceptions.ProviderException, IOException
      Deprecated.
      Get attachment data.
      Parameters:
      att - The attachment
      Returns:
      An InputStream which you contains the raw data of the object. It's your responsibility to close it.
      Throws:
      org.apache.wiki.api.exceptions.ProviderException - If the attachment cannot be found
      IOException - If the attachment cannot be opened
    • listAttachments

      List<org.apache.wiki.attachment.Attachment> listAttachments(org.apache.wiki.WikiPage page) throws org.apache.wiki.api.exceptions.ProviderException
      Deprecated.
      Lists all attachments attached to a page.
      Parameters:
      page - The page to list the attachments from.
      Returns:
      A collection of Attachment objects. May be empty, but never null.
      Throws:
      org.apache.wiki.api.exceptions.ProviderException - If something goes wrong when listing the attachments.
    • findAttachments

      Collection<org.apache.wiki.attachment.Attachment> findAttachments(org.apache.wiki.search.QueryItem[] query)
      Deprecated.
      Finds attachments based on the query.
      Parameters:
      query - An array of QueryItem objects to search for
      Returns:
      A Collection of Attachment objects. May be empty, but never null.
    • listAllChanged

      List<org.apache.wiki.attachment.Attachment> listAllChanged(Date timestamp) throws org.apache.wiki.api.exceptions.ProviderException
      Deprecated.
      Lists changed attachments since given date. Can also be used to fetch a list of all pages.

      This is different from WikiPageProvider, where you basically get a list of all pages, then sort them locally. However, since some providers can be more efficient in locating recently changed files (like any database) than our non-optimized Java code, it makes more sense to fetch the whole list this way.

      To get all files, call this with Date(0L);

      Parameters:
      timestamp - List all files from this date onward.
      Returns:
      A List of Attachment objects, in most-recently-changed first order.
      Throws:
      org.apache.wiki.api.exceptions.ProviderException - If something goes wrong.
    • getAttachmentInfo

      org.apache.wiki.attachment.Attachment getAttachmentInfo(org.apache.wiki.WikiPage page, String name, int version) throws org.apache.wiki.api.exceptions.ProviderException
      Deprecated.
      Returns info about an attachment.
      Parameters:
      page - The parent page
      name - The name of the attachment
      version - The version of the attachment (it's okay to use WikiPage.LATEST_VERSION to find the latest one)
      Returns:
      An attachment object
      Throws:
      org.apache.wiki.api.exceptions.ProviderException - If the attachment cannot be found or some other error occurs.
    • getVersionHistory

      List<org.apache.wiki.attachment.Attachment> getVersionHistory(org.apache.wiki.attachment.Attachment att)
      Deprecated.
      Returns version history. Each element should be an Attachment.
      Parameters:
      att - The attachment for which to find the version history for.
      Returns:
      A List of Attachment objects.
    • deleteVersion

      void deleteVersion(org.apache.wiki.attachment.Attachment att) throws org.apache.wiki.api.exceptions.ProviderException
      Deprecated.
      Removes a specific version from the repository. The implementations should really do no more security checks, since that is the domain of the AttachmentManager. Just delete it as efficiently as you can.
      Parameters:
      att - Attachment to be removed. The version field is checked, and thus only that version is removed.
      Throws:
      org.apache.wiki.api.exceptions.ProviderException - If the attachment cannot be removed for some reason.
      Since:
      2.0.19.
    • deleteAttachment

      void deleteAttachment(org.apache.wiki.attachment.Attachment att) throws org.apache.wiki.api.exceptions.ProviderException
      Deprecated.
      Removes an entire page from the repository. The implementations should really do no more security checks, since that is the domain of the AttachmentManager. Just delete it as efficiently as you can. You should also delete any auxiliary files and directories that belong to this attachment, IF they were created by this provider.
      Parameters:
      att - Attachment to delete.
      Throws:
      org.apache.wiki.api.exceptions.ProviderException - If the page could not be removed for some reason.
      Since:
      2.0.17.
    • moveAttachmentsForPage

      void moveAttachmentsForPage(String oldParent, String newParent) throws org.apache.wiki.api.exceptions.ProviderException
      Deprecated.
      Move all the attachments for a given page so that they are attached to a new page.
      Parameters:
      oldParent - Name of the page we are to move the attachments from.
      newParent - Name of the page we are to move the attachments to.
      Throws:
      org.apache.wiki.api.exceptions.ProviderException - If the attachments could not be moved for some reason.