Class BasicAttachmentProvider

java.lang.Object
org.apache.wiki.providers.BasicAttachmentProvider
All Implemented Interfaces:
org.apache.wiki.api.providers.AttachmentProvider, org.apache.wiki.api.providers.WikiProvider

public class BasicAttachmentProvider extends Object implements org.apache.wiki.api.providers.AttachmentProvider
Provides basic, versioning attachments.
   Structure is as follows:
      attachment_dir/
         ThisPage/
            attachment.doc/
               attachment.properties
               1.doc
               2.doc
               3.doc
            picture.png/
               attachment.properties
               1.png
               2.png
         ThatPage/
            picture.png/
               attachment.properties
               1.png
             
  
The names of the directories will be URLencoded.

"attachment.properties" consists of the following items:

  • 1.author = author name for version 1 (etc)
  • Field Details

  • Constructor Details

  • Method Details

    • initialize

      public void initialize(org.apache.wiki.api.core.Engine engine, Properties properties) throws org.apache.wiki.api.exceptions.NoRequiredPropertyException, IOException
      Specified by:
      initialize in interface org.apache.wiki.api.providers.WikiProvider
      Throws:
      org.apache.wiki.api.exceptions.NoRequiredPropertyException
      IOException
    • getFileExtension

      protected static String getFileExtension(String filename)
      Returns the file extension. For example "test.png" returns "png".

      If file has no extension, will return "bin"

      Parameters:
      filename - The file name to check
      Returns:
      The extension. If no extension is found, returns "bin".
    • putAttachmentData

      public void putAttachmentData(org.apache.wiki.api.core.Attachment att, InputStream data) throws org.apache.wiki.api.exceptions.ProviderException, IOException
      Specified by:
      putAttachmentData in interface org.apache.wiki.api.providers.AttachmentProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
      IOException
    • getProviderInfo

      Specified by:
      getProviderInfo in interface org.apache.wiki.api.providers.WikiProvider
    • getAttachmentData

      public InputStream getAttachmentData(org.apache.wiki.api.core.Attachment att) throws IOException, org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      getAttachmentData in interface org.apache.wiki.api.providers.AttachmentProvider
      Throws:
      IOException
      org.apache.wiki.api.exceptions.ProviderException
    • listAttachments

      public List<org.apache.wiki.api.core.Attachment> listAttachments(org.apache.wiki.api.core.Page page) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      listAttachments in interface org.apache.wiki.api.providers.AttachmentProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • findAttachments

      public Collection<org.apache.wiki.api.core.Attachment> findAttachments(org.apache.wiki.api.search.QueryItem[] query)
      Specified by:
      findAttachments in interface org.apache.wiki.api.providers.AttachmentProvider
    • listAllChanged

      public List<org.apache.wiki.api.core.Attachment> listAllChanged(Date timestamp) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      listAllChanged in interface org.apache.wiki.api.providers.AttachmentProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • getAttachmentInfo

      public org.apache.wiki.api.core.Attachment getAttachmentInfo(org.apache.wiki.api.core.Page page, String name, int version) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      getAttachmentInfo in interface org.apache.wiki.api.providers.AttachmentProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • getVersionHistory

      public List<org.apache.wiki.api.core.Attachment> getVersionHistory(org.apache.wiki.api.core.Attachment att)
      Specified by:
      getVersionHistory in interface org.apache.wiki.api.providers.AttachmentProvider
    • deleteVersion

      public void deleteVersion(org.apache.wiki.api.core.Attachment att) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      deleteVersion in interface org.apache.wiki.api.providers.AttachmentProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • deleteAttachment

      public void deleteAttachment(org.apache.wiki.api.core.Attachment att) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      deleteAttachment in interface org.apache.wiki.api.providers.AttachmentProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • moveAttachmentsForPage

      public void moveAttachmentsForPage(String oldParent, String newParent) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      moveAttachmentsForPage in interface org.apache.wiki.api.providers.AttachmentProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException