|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.ecyrd.jspwiki.providers.BasicAttachmentProvider
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:
| Nested Class Summary | |
class |
BasicAttachmentProvider.AttachmentFilter
Returns only those directories that contain attachments. |
class |
BasicAttachmentProvider.AttachmentVersionFilter
Accepts only files that are actual versions, no control files. |
| Field Summary | |
static java.lang.String |
ATTDIR_EXTENSION
|
static java.lang.String |
DIR_EXTENSION
|
static java.lang.String |
PROP_STORAGEDIR
|
static java.lang.String |
PROPERTY_FILE
|
| Fields inherited from interface com.ecyrd.jspwiki.WikiProvider |
LATEST_VERSION |
| Constructor Summary | |
BasicAttachmentProvider()
|
|
| Method Summary | |
void |
deleteAttachment(Attachment att)
Removes an entire page from the repository. |
void |
deleteVersion(Attachment att)
Removes a specific version from the repository. |
java.util.Collection |
findAttachments(QueryItem[] query)
Finds attachments based on the query. |
java.io.InputStream |
getAttachmentData(Attachment att)
Get attachment data. |
Attachment |
getAttachmentInfo(WikiPage page,
java.lang.String name,
int version)
Returns info about an attachment. |
protected static java.lang.String |
getFileExtension(java.lang.String filename)
Returns the file extension. |
java.lang.String |
getProviderInfo()
Return a valid HTML string for information. |
java.util.List |
getVersionHistory(Attachment att)
Returns version history. |
void |
initialize(java.util.Properties properties)
Initializes the page provider. |
java.util.List |
listAllChanged(java.util.Date timestamp)
Lists changed attachments since given date. |
java.util.Collection |
listAttachments(WikiPage page)
Lists all attachments attached to a page. |
void |
putAttachmentData(Attachment att,
java.io.InputStream data)
Put new attachment data. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String PROP_STORAGEDIR
public static final java.lang.String PROPERTY_FILE
public static final java.lang.String DIR_EXTENSION
public static final java.lang.String ATTDIR_EXTENSION
| Constructor Detail |
public BasicAttachmentProvider()
| Method Detail |
public void initialize(java.util.Properties properties)
throws NoRequiredPropertyException,
java.io.IOException
WikiProvider
initialize in interface WikiProviderNoRequiredPropertyException
java.io.IOExceptionprotected static java.lang.String getFileExtension(java.lang.String filename)
If file has no extension, will return "bin"
public void putAttachmentData(Attachment att,
java.io.InputStream data)
throws ProviderException,
java.io.IOException
WikiAttachmentProvider
putAttachmentData in interface WikiAttachmentProviderProviderException
java.io.IOExceptionpublic java.lang.String getProviderInfo()
WikiProvider
getProviderInfo in interface WikiProvider
public java.io.InputStream getAttachmentData(Attachment att)
throws java.io.IOException,
ProviderException
WikiAttachmentProvider
getAttachmentData in interface WikiAttachmentProviderjava.io.IOException
ProviderException
public java.util.Collection listAttachments(WikiPage page)
throws ProviderException
WikiAttachmentProvider
listAttachments in interface WikiAttachmentProviderProviderExceptionpublic java.util.Collection findAttachments(QueryItem[] query)
WikiAttachmentProvider
findAttachments in interface WikiAttachmentProvider
public java.util.List listAllChanged(java.util.Date timestamp)
throws ProviderException
WikiAttachmentProviderThis is different from WikiPageProvider, where you basically get a list of all pages, then sort them locally. However, since some providers can be more efficient in locating recently changed files (like any database) than our non-optimized Java code, it makes more sense to fetch the whole list this way.
To get all files, call this with Date(0L);
listAllChanged in interface WikiAttachmentProvidertimestamp - List all files from this date onward.
ProviderException
public Attachment getAttachmentInfo(WikiPage page,
java.lang.String name,
int version)
throws ProviderException
WikiAttachmentProvider
getAttachmentInfo in interface WikiAttachmentProviderProviderExceptionpublic java.util.List getVersionHistory(Attachment att)
WikiAttachmentProvider
getVersionHistory in interface WikiAttachmentProvider
public void deleteVersion(Attachment att)
throws ProviderException
WikiAttachmentProvider
deleteVersion in interface WikiAttachmentProvideratt - Attachment to be removed. The version field is checked, and thus
only that version is removed.
ProviderException - If the attachment cannot be removed for some reason.
public void deleteAttachment(Attachment att)
throws ProviderException
WikiAttachmentProvider
deleteAttachment in interface WikiAttachmentProvideratt - Attachment to delete.
ProviderException - If the page could not be removed for some reason.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||