Package org.apache.wiki.providers
Class BasicAttachmentProvider
java.lang.Object
org.apache.wiki.providers.BasicAttachmentProvider
- All Implemented Interfaces:
AttachmentProvider,WikiProvider
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)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classReturns only those directories that contain attachments.static classAccepts only files that are actual versions, no control files. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default extension for the attachment directory.static final StringThe default extension for the page attachment directory name.static final StringThe property name for specifying which attachments are not cached.static final StringThe name of the property file.Fields inherited from interface org.apache.wiki.api.providers.AttachmentProvider
PROP_STORAGEDIRFields inherited from interface org.apache.wiki.api.providers.WikiProvider
LATEST_VERSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddeleteVersion(Attachment att) findAttachments(QueryItem[] query) getAttachmentInfo(Page page, String name, int version) protected static StringgetFileExtension(String filename) Returns the file extension.voidinitialize(Engine engine, Properties properties) listAllChanged(Date timestamp) listAttachments(Page page) voidmoveAttachmentsForPage(String oldParent, String newParent) voidputAttachmentData(Attachment att, InputStream data)
-
Field Details
-
PROP_DISABLECACHE
The property name for specifying which attachments are not cached. Value is "jspwiki.basicAttachmentProvider.disableCache".- See Also:
-
PROPERTY_FILE
The name of the property file.- See Also:
-
DIR_EXTENSION
The default extension for the page attachment directory name.- See Also:
-
ATTDIR_EXTENSION
The default extension for the attachment directory.- See Also:
-
-
Constructor Details
-
BasicAttachmentProvider
public BasicAttachmentProvider()
-
-
Method Details
-
initialize
public void initialize(Engine engine, Properties properties) throws NoRequiredPropertyException, IOException - Specified by:
initializein interfaceWikiProvider- Throws:
NoRequiredPropertyExceptionIOException
-
getFileExtension
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, InputStream data) throws ProviderException, IOException - Specified by:
putAttachmentDatain interfaceAttachmentProvider- Throws:
ProviderExceptionIOException
-
getProviderInfo
- Specified by:
getProviderInfoin interfaceWikiProvider
-
getAttachmentData
- Specified by:
getAttachmentDatain interfaceAttachmentProvider- Throws:
IOExceptionProviderException
-
listAttachments
- Specified by:
listAttachmentsin interfaceAttachmentProvider- Throws:
ProviderException
-
findAttachments
- Specified by:
findAttachmentsin interfaceAttachmentProvider
-
listAllChanged
- Specified by:
listAllChangedin interfaceAttachmentProvider- Throws:
ProviderException
-
getAttachmentInfo
- Specified by:
getAttachmentInfoin interfaceAttachmentProvider- Throws:
ProviderException
-
getVersionHistory
- Specified by:
getVersionHistoryin interfaceAttachmentProvider
-
deleteVersion
- Specified by:
deleteVersionin interfaceAttachmentProvider- Throws:
ProviderException
-
deleteAttachment
- Specified by:
deleteAttachmentin interfaceAttachmentProvider- Throws:
ProviderException
-
moveAttachmentsForPage
- Specified by:
moveAttachmentsForPagein interfaceAttachmentProvider- Throws:
ProviderException
-