com.ecyrd.jspwiki.providers
Class WikiBasicAttachmentProvider

java.lang.Object
  extended by com.ecyrd.jspwiki.providers.WikiBasicAttachmentProvider
All Implemented Interfaces:
com.ecyrd.jspwiki.providers.WikiAttachmentProvider, com.ecyrd.jspwiki.WikiProvider

public class WikiBasicAttachmentProvider
extends Object
implements com.ecyrd.jspwiki.providers.WikiAttachmentProvider

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:


Nested Class Summary
static class WikiBasicAttachmentProvider.AttachmentFilter
          Returns only those directories that contain attachments.
static class WikiBasicAttachmentProvider.AttachmentVersionFilter
          Accepts only files that are actual versions, no control files.
 
Field Summary
static String ATTDIR_EXTENSION
           
static String DIR_EXTENSION
           
static String PROP_DISABLECACHE
           
static String PROP_STORAGEDIR
           
static String PROPERTY_FILE
           
 
Fields inherited from interface com.ecyrd.jspwiki.WikiProvider
LATEST_VERSION
 
Constructor Summary
WikiBasicAttachmentProvider()
           
 
Method Summary
 void deleteAttachment(com.ecyrd.jspwiki.attachment.Attachment att)
           
 void deleteVersion(com.ecyrd.jspwiki.attachment.Attachment att)
           
 Collection findAttachments(com.ecyrd.jspwiki.QueryItem[] query)
           
 InputStream getAttachmentData(com.ecyrd.jspwiki.attachment.Attachment att)
           
 String getAttachmentFilePath(com.ecyrd.jspwiki.attachment.Attachment att)
           
 com.ecyrd.jspwiki.attachment.Attachment getAttachmentInfo(com.ecyrd.jspwiki.WikiPage page, String name, int version)
           
protected static String getFileExtension(String filename)
          Returns the file extension.
 String getProviderInfo()
           
 List getVersionHistory(com.ecyrd.jspwiki.attachment.Attachment att)
           
 void initialize(com.ecyrd.jspwiki.WikiEngine engine, Properties properties)
           
 List listAllChanged(Date timestamp)
           
 Collection listAttachments(com.ecyrd.jspwiki.WikiPage page)
           
 void moveAttachmentsForPage(String oldParent, String newParent)
           
 void putAttachmentData(com.ecyrd.jspwiki.attachment.Attachment att, InputStream data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_STORAGEDIR

public static final String PROP_STORAGEDIR
See Also:
Constant Field Values

PROP_DISABLECACHE

public static final String PROP_DISABLECACHE
See Also:
Constant Field Values

PROPERTY_FILE

public static final String PROPERTY_FILE
See Also:
Constant Field Values

DIR_EXTENSION

public static final String DIR_EXTENSION
See Also:
Constant Field Values

ATTDIR_EXTENSION

public static final String ATTDIR_EXTENSION
See Also:
Constant Field Values
Constructor Detail

WikiBasicAttachmentProvider

public WikiBasicAttachmentProvider()
Method Detail

initialize

public void initialize(com.ecyrd.jspwiki.WikiEngine engine,
                       Properties properties)
                throws com.ecyrd.jspwiki.NoRequiredPropertyException,
                       IOException
Specified by:
initialize in interface com.ecyrd.jspwiki.WikiProvider
Throws:
com.ecyrd.jspwiki.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"


putAttachmentData

public void putAttachmentData(com.ecyrd.jspwiki.attachment.Attachment att,
                              InputStream data)
                       throws com.ecyrd.jspwiki.providers.ProviderException,
                              IOException
Specified by:
putAttachmentData in interface com.ecyrd.jspwiki.providers.WikiAttachmentProvider
Throws:
com.ecyrd.jspwiki.providers.ProviderException
IOException

getProviderInfo

public String getProviderInfo()
Specified by:
getProviderInfo in interface com.ecyrd.jspwiki.WikiProvider

getAttachmentFilePath

public String getAttachmentFilePath(com.ecyrd.jspwiki.attachment.Attachment att)
                             throws IOException,
                                    com.ecyrd.jspwiki.providers.ProviderException
Throws:
IOException
com.ecyrd.jspwiki.providers.ProviderException

getAttachmentData

public InputStream getAttachmentData(com.ecyrd.jspwiki.attachment.Attachment att)
                              throws IOException,
                                     com.ecyrd.jspwiki.providers.ProviderException
Specified by:
getAttachmentData in interface com.ecyrd.jspwiki.providers.WikiAttachmentProvider
Throws:
IOException
com.ecyrd.jspwiki.providers.ProviderException

listAttachments

public Collection listAttachments(com.ecyrd.jspwiki.WikiPage page)
                           throws com.ecyrd.jspwiki.providers.ProviderException
Specified by:
listAttachments in interface com.ecyrd.jspwiki.providers.WikiAttachmentProvider
Throws:
com.ecyrd.jspwiki.providers.ProviderException

findAttachments

public Collection findAttachments(com.ecyrd.jspwiki.QueryItem[] query)
Specified by:
findAttachments in interface com.ecyrd.jspwiki.providers.WikiAttachmentProvider

listAllChanged

public List listAllChanged(Date timestamp)
                    throws com.ecyrd.jspwiki.providers.ProviderException
Specified by:
listAllChanged in interface com.ecyrd.jspwiki.providers.WikiAttachmentProvider
Throws:
com.ecyrd.jspwiki.providers.ProviderException

getAttachmentInfo

public com.ecyrd.jspwiki.attachment.Attachment getAttachmentInfo(com.ecyrd.jspwiki.WikiPage page,
                                                                 String name,
                                                                 int version)
                                                          throws com.ecyrd.jspwiki.providers.ProviderException
Specified by:
getAttachmentInfo in interface com.ecyrd.jspwiki.providers.WikiAttachmentProvider
Throws:
com.ecyrd.jspwiki.providers.ProviderException

getVersionHistory

public List getVersionHistory(com.ecyrd.jspwiki.attachment.Attachment att)
Specified by:
getVersionHistory in interface com.ecyrd.jspwiki.providers.WikiAttachmentProvider

deleteVersion

public void deleteVersion(com.ecyrd.jspwiki.attachment.Attachment att)
                   throws com.ecyrd.jspwiki.providers.ProviderException
Specified by:
deleteVersion in interface com.ecyrd.jspwiki.providers.WikiAttachmentProvider
Throws:
com.ecyrd.jspwiki.providers.ProviderException

deleteAttachment

public void deleteAttachment(com.ecyrd.jspwiki.attachment.Attachment att)
                      throws com.ecyrd.jspwiki.providers.ProviderException
Specified by:
deleteAttachment in interface com.ecyrd.jspwiki.providers.WikiAttachmentProvider
Throws:
com.ecyrd.jspwiki.providers.ProviderException

moveAttachmentsForPage

public void moveAttachmentsForPage(String oldParent,
                                   String newParent)
                            throws com.ecyrd.jspwiki.providers.ProviderException
Specified by:
moveAttachmentsForPage in interface com.ecyrd.jspwiki.providers.WikiAttachmentProvider
Throws:
com.ecyrd.jspwiki.providers.ProviderException


Copyright © 2016 Silverpeas. All Rights Reserved.