public class BasicAttachmentProvider extends java.lang.Object implements AttachmentProvider
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:
| Modifier and Type | Class and Description |
|---|---|
static class |
BasicAttachmentProvider.AttachmentFilter
Returns only those directories that contain attachments.
|
static class |
BasicAttachmentProvider.AttachmentVersionFilter
Accepts only files that are actual versions, no control files.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ATTDIR_EXTENSION
The default extension for the attachment directory.
|
static java.lang.String |
DIR_EXTENSION
The default extension for the page attachment directory name.
|
static java.lang.String |
PROP_DISABLECACHE
The property name for specifying which attachments are not cached.
|
static java.lang.String |
PROPERTY_FILE
The name of the property file.
|
PROP_STORAGEDIRLATEST_VERSION| Constructor and Description |
|---|
BasicAttachmentProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
deleteAttachment(Attachment att) |
void |
deleteVersion(Attachment att) |
java.util.Collection<Attachment> |
findAttachments(QueryItem[] query) |
java.io.InputStream |
getAttachmentData(Attachment att) |
Attachment |
getAttachmentInfo(Page page,
java.lang.String name,
int version) |
protected static java.lang.String |
getFileExtension(java.lang.String filename)
Returns the file extension.
|
java.lang.String |
getProviderInfo() |
java.util.List<Attachment> |
getVersionHistory(Attachment att) |
void |
initialize(Engine engine,
java.util.Properties properties) |
java.util.List<Attachment> |
listAllChanged(java.util.Date timestamp) |
java.util.List<Attachment> |
listAttachments(Page page) |
void |
moveAttachmentsForPage(java.lang.String oldParent,
java.lang.String newParent) |
void |
putAttachmentData(Attachment att,
java.io.InputStream data) |
public static final java.lang.String PROP_DISABLECACHE
public static final java.lang.String PROPERTY_FILE
public static final java.lang.String DIR_EXTENSION
public static final java.lang.String ATTDIR_EXTENSION
public BasicAttachmentProvider()
public void initialize(Engine engine, java.util.Properties properties) throws NoRequiredPropertyException, java.io.IOException
initialize in interface WikiProviderNoRequiredPropertyExceptionjava.io.IOExceptionprotected static java.lang.String getFileExtension(java.lang.String filename)
If file has no extension, will return "bin"
filename - The file name to checkpublic void putAttachmentData(Attachment att, java.io.InputStream data) throws ProviderException, java.io.IOException
putAttachmentData in interface AttachmentProviderProviderExceptionjava.io.IOExceptionpublic java.lang.String getProviderInfo()
getProviderInfo in interface WikiProviderpublic java.io.InputStream getAttachmentData(Attachment att) throws java.io.IOException, ProviderException
getAttachmentData in interface AttachmentProviderjava.io.IOExceptionProviderExceptionpublic java.util.List<Attachment> listAttachments(Page page) throws ProviderException
listAttachments in interface AttachmentProviderProviderExceptionpublic java.util.Collection<Attachment> findAttachments(QueryItem[] query)
findAttachments in interface AttachmentProviderpublic java.util.List<Attachment> listAllChanged(java.util.Date timestamp) throws ProviderException
listAllChanged in interface AttachmentProviderProviderExceptionpublic Attachment getAttachmentInfo(Page page, java.lang.String name, int version) throws ProviderException
getAttachmentInfo in interface AttachmentProviderProviderExceptionpublic java.util.List<Attachment> getVersionHistory(Attachment att)
getVersionHistory in interface AttachmentProviderpublic void deleteVersion(Attachment att) throws ProviderException
deleteVersion in interface AttachmentProviderProviderExceptionpublic void deleteAttachment(Attachment att) throws ProviderException
deleteAttachment in interface AttachmentProviderProviderExceptionpublic void moveAttachmentsForPage(java.lang.String oldParent, java.lang.String newParent) throws ProviderException
moveAttachmentsForPage in interface AttachmentProviderProviderExceptionCopyright (c) 2001-2022 The Apache Software Foundation. All rights reserved.