Package org.apache.wiki.providers
Class BasicAttachmentProvider
- java.lang.Object
-
- org.apache.wiki.providers.BasicAttachmentProvider
-
- All Implemented Interfaces:
AttachmentProvider,WikiProvider
public class BasicAttachmentProvider extends java.lang.Object implements 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.pngThe names of the directories will be URLencoded."attachment.properties" consists of the following items:
- 1.author = author name for version 1 (etc)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBasicAttachmentProvider.AttachmentFilterReturns only those directories that contain attachments.static classBasicAttachmentProvider.AttachmentVersionFilterAccepts only files that are actual versions, no control files.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTDIR_EXTENSIONThe default extension for the attachment directory.static java.lang.StringDIR_EXTENSIONThe default extension for the page attachment directory name.static java.lang.StringPROP_DISABLECACHEThe property name for specifying which attachments are not cached.static java.lang.StringPROPERTY_FILEThe name of the property file.-
Fields inherited from interface org.apache.wiki.api.providers.AttachmentProvider
PROP_STORAGEDIR
-
Fields inherited from interface org.apache.wiki.api.providers.WikiProvider
LATEST_VERSION
-
-
Constructor Summary
Constructors Constructor Description BasicAttachmentProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteAttachment(Attachment att)voiddeleteVersion(Attachment att)java.util.Collection<Attachment>findAttachments(QueryItem[] query)java.io.InputStreamgetAttachmentData(Attachment att)AttachmentgetAttachmentInfo(Page page, java.lang.String name, int version)protected static java.lang.StringgetFileExtension(java.lang.String filename)Returns the file extension.java.lang.StringgetProviderInfo()java.util.List<Attachment>getVersionHistory(Attachment att)voidinitialize(Engine engine, java.util.Properties properties)java.util.List<Attachment>listAllChanged(java.util.Date timestamp)java.util.List<Attachment>listAttachments(Page page)voidmoveAttachmentsForPage(java.lang.String oldParent, java.lang.String newParent)voidputAttachmentData(Attachment att, java.io.InputStream data)
-
-
-
Field Detail
-
PROP_DISABLECACHE
public static final java.lang.String PROP_DISABLECACHE
The property name for specifying which attachments are not cached. Value is "jspwiki.basicAttachmentProvider.disableCache".- See Also:
- Constant Field Values
-
PROPERTY_FILE
public static final java.lang.String PROPERTY_FILE
The name of the property file.- See Also:
- Constant Field Values
-
DIR_EXTENSION
public static final java.lang.String DIR_EXTENSION
The default extension for the page attachment directory name.- See Also:
- Constant Field Values
-
ATTDIR_EXTENSION
public static final java.lang.String ATTDIR_EXTENSION
The default extension for the attachment directory.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BasicAttachmentProvider
public BasicAttachmentProvider()
-
-
Method Detail
-
initialize
public void initialize(Engine engine, java.util.Properties properties) throws NoRequiredPropertyException, java.io.IOException
- Specified by:
initializein interfaceWikiProvider- Throws:
NoRequiredPropertyExceptionjava.io.IOException
-
getFileExtension
protected static java.lang.String getFileExtension(java.lang.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(Attachment att, java.io.InputStream data) throws ProviderException, java.io.IOException
- Specified by:
putAttachmentDatain interfaceAttachmentProvider- Throws:
ProviderExceptionjava.io.IOException
-
getProviderInfo
public java.lang.String getProviderInfo()
- Specified by:
getProviderInfoin interfaceWikiProvider
-
getAttachmentData
public java.io.InputStream getAttachmentData(Attachment att) throws java.io.IOException, ProviderException
- Specified by:
getAttachmentDatain interfaceAttachmentProvider- Throws:
java.io.IOExceptionProviderException
-
listAttachments
public java.util.List<Attachment> listAttachments(Page page) throws ProviderException
- Specified by:
listAttachmentsin interfaceAttachmentProvider- Throws:
ProviderException
-
findAttachments
public java.util.Collection<Attachment> findAttachments(QueryItem[] query)
- Specified by:
findAttachmentsin interfaceAttachmentProvider
-
listAllChanged
public java.util.List<Attachment> listAllChanged(java.util.Date timestamp) throws ProviderException
- Specified by:
listAllChangedin interfaceAttachmentProvider- Throws:
ProviderException
-
getAttachmentInfo
public Attachment getAttachmentInfo(Page page, java.lang.String name, int version) throws ProviderException
- Specified by:
getAttachmentInfoin interfaceAttachmentProvider- Throws:
ProviderException
-
getVersionHistory
public java.util.List<Attachment> getVersionHistory(Attachment att)
- Specified by:
getVersionHistoryin interfaceAttachmentProvider
-
deleteVersion
public void deleteVersion(Attachment att) throws ProviderException
- Specified by:
deleteVersionin interfaceAttachmentProvider- Throws:
ProviderException
-
deleteAttachment
public void deleteAttachment(Attachment att) throws ProviderException
- Specified by:
deleteAttachmentin interfaceAttachmentProvider- Throws:
ProviderException
-
moveAttachmentsForPage
public void moveAttachmentsForPage(java.lang.String oldParent, java.lang.String newParent) throws ProviderException
- Specified by:
moveAttachmentsForPagein interfaceAttachmentProvider- Throws:
ProviderException
-
-