public class BasicAttachmentProvider extends 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 String |
ATTDIR_EXTENSION
The default extension for the attachment directory.
|
static String |
DIR_EXTENSION
The default extension for the page attachment directory name.
|
static String |
PROP_DISABLECACHE
The property name for specifying which attachments are not cached.
|
static 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) |
Collection<Attachment> |
findAttachments(QueryItem[] query) |
InputStream |
getAttachmentData(Attachment att) |
Attachment |
getAttachmentInfo(Page page,
String name,
int version) |
protected static String |
getFileExtension(String filename)
Returns the file extension.
|
String |
getProviderInfo() |
List<Attachment> |
getVersionHistory(Attachment att) |
void |
initialize(Engine engine,
Properties properties) |
List<Attachment> |
listAllChanged(Date timestamp) |
List<Attachment> |
listAttachments(Page page) |
void |
moveAttachmentsForPage(String oldParent,
String newParent) |
void |
putAttachmentData(Attachment att,
InputStream data) |
public static final String PROP_DISABLECACHE
public static final String PROPERTY_FILE
public static final String DIR_EXTENSION
public static final String ATTDIR_EXTENSION
public BasicAttachmentProvider()
public void initialize(Engine engine, Properties properties) throws NoRequiredPropertyException, IOException
initialize in interface WikiProviderNoRequiredPropertyExceptionIOExceptionprotected static String getFileExtension(String filename)
If file has no extension, will return "bin"
filename - The file name to checkpublic void putAttachmentData(Attachment att, InputStream data) throws ProviderException, IOException
putAttachmentData in interface AttachmentProviderProviderExceptionIOExceptionpublic String getProviderInfo()
getProviderInfo in interface WikiProviderpublic InputStream getAttachmentData(Attachment att) throws IOException, ProviderException
getAttachmentData in interface AttachmentProviderIOExceptionProviderExceptionpublic List<Attachment> listAttachments(Page page) throws ProviderException
listAttachments in interface AttachmentProviderProviderExceptionpublic Collection<Attachment> findAttachments(QueryItem[] query)
findAttachments in interface AttachmentProviderpublic List<Attachment> listAllChanged(Date timestamp) throws ProviderException
listAllChanged in interface AttachmentProviderProviderExceptionpublic Attachment getAttachmentInfo(Page page, String name, int version) throws ProviderException
getAttachmentInfo in interface AttachmentProviderProviderExceptionpublic 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(String oldParent, String newParent) throws ProviderException
moveAttachmentsForPage in interface AttachmentProviderProviderExceptionCopyright © 2001-2020 The Apache Software Foundation. All rights reserved.