Package org.apache.wiki.providers
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)
-
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 TypeMethodDescriptionvoiddeleteAttachment(org.apache.wiki.api.core.Attachment att) voiddeleteVersion(org.apache.wiki.api.core.Attachment att) Collection<org.apache.wiki.api.core.Attachment>findAttachments(org.apache.wiki.api.search.QueryItem[] query) getAttachmentData(org.apache.wiki.api.core.Attachment att) org.apache.wiki.api.core.AttachmentgetAttachmentInfo(org.apache.wiki.api.core.Page page, String name, int version) protected static StringgetFileExtension(String filename) Returns the file extension.List<org.apache.wiki.api.core.Attachment>getVersionHistory(org.apache.wiki.api.core.Attachment att) voidinitialize(org.apache.wiki.api.core.Engine engine, Properties properties) List<org.apache.wiki.api.core.Attachment>listAllChanged(Date timestamp) List<org.apache.wiki.api.core.Attachment>listAttachments(org.apache.wiki.api.core.Page page) voidmoveAttachmentsForPage(String oldParent, String newParent) voidputAttachmentData(org.apache.wiki.api.core.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(org.apache.wiki.api.core.Engine engine, Properties properties) throws org.apache.wiki.api.exceptions.NoRequiredPropertyException, IOException - Specified by:
initializein interfaceorg.apache.wiki.api.providers.WikiProvider- Throws:
org.apache.wiki.api.exceptions.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(org.apache.wiki.api.core.Attachment att, InputStream data) throws org.apache.wiki.api.exceptions.ProviderException, IOException - Specified by:
putAttachmentDatain interfaceorg.apache.wiki.api.providers.AttachmentProvider- Throws:
org.apache.wiki.api.exceptions.ProviderExceptionIOException
-
getProviderInfo
- Specified by:
getProviderInfoin interfaceorg.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:
getAttachmentDatain interfaceorg.apache.wiki.api.providers.AttachmentProvider- Throws:
IOExceptionorg.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:
listAttachmentsin interfaceorg.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:
findAttachmentsin interfaceorg.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:
listAllChangedin interfaceorg.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:
getAttachmentInfoin interfaceorg.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:
getVersionHistoryin interfaceorg.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:
deleteVersionin interfaceorg.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:
deleteAttachmentin interfaceorg.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:
moveAttachmentsForPagein interfaceorg.apache.wiki.api.providers.AttachmentProvider- Throws:
org.apache.wiki.api.exceptions.ProviderException
-