public class WikiAttachmentProvider extends java.lang.Object implements WikiAttachmentProvider
LATEST_VERSION
Constructor and Description |
---|
WikiAttachmentProvider() |
Modifier and Type | Method and Description |
---|---|
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.
|
java.lang.String |
getProviderInfo()
Return a valid HTML string for information.
|
java.util.List |
getVersionHistory(Attachment att)
Returns version history.
|
void |
initialize(WikiEngine engine,
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 |
moveAttachmentsForPage(java.lang.String oldParent,
java.lang.String newParent)
Move all the attachments for a given page so that they are attached to a
new page.
|
void |
putAttachmentData(Attachment att,
java.io.InputStream data)
Put new attachment data.
|
public void putAttachmentData(Attachment att, java.io.InputStream data) throws ProviderException, java.io.IOException
putAttachmentData
in interface WikiAttachmentProvider
att
- Attachment object to add new data todata
- The stream from which the provider should read the dataProviderException
- If there are other errors.java.io.IOException
- If writing failspublic java.io.InputStream getAttachmentData(Attachment att) throws ProviderException, java.io.IOException
getAttachmentData
in interface WikiAttachmentProvider
att
- The attachmentProviderException
- If the attachment cannot be foundjava.io.IOException
- If the attachment cannot be openedpublic java.util.Collection listAttachments(WikiPage page) throws ProviderException
listAttachments
in interface WikiAttachmentProvider
page
- The page to list the attachments from.ProviderException
- If something goes wrong when listing the attachments.public java.util.Collection findAttachments(QueryItem[] query)
findAttachments
in interface WikiAttachmentProvider
query
- An array of QueryItem objects to search forpublic java.util.List listAllChanged(java.util.Date timestamp) throws ProviderException
This 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 WikiAttachmentProvider
timestamp
- List all files from this date onward.ProviderException
- If something goes wrong.public Attachment getAttachmentInfo(WikiPage page, java.lang.String name, int version) throws ProviderException
getAttachmentInfo
in interface WikiAttachmentProvider
page
- The parent pagename
- The name of the attachmentversion
- The version of the attachment (it's okay to use WikiPage.LATEST_VERSION to find the latest one)ProviderException
- If the attachment cannot be found or some other error occurs.public java.util.List getVersionHistory(Attachment att)
getVersionHistory
in interface WikiAttachmentProvider
att
- The attachment for which to find the version history for.public void deleteVersion(Attachment att) throws ProviderException
deleteVersion
in interface WikiAttachmentProvider
att
- 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
deleteAttachment
in interface WikiAttachmentProvider
att
- Attachment to delete.ProviderException
- If the page could not be removed for some reason.public void moveAttachmentsForPage(java.lang.String oldParent, java.lang.String newParent) throws ProviderException
moveAttachmentsForPage
in interface WikiAttachmentProvider
oldParent
- Name of the page we are to move the attachments from.newParent
- Name of the page we are to move the attachments to.ProviderException
- If the attachments could not be moved for some
reason.public void initialize(WikiEngine engine, java.util.Properties properties) throws NoRequiredPropertyException, java.io.IOException
initialize
in interface WikiProvider
engine
- WikiEngine to own this providerproperties
- A set of properties used to initialize this providerNoRequiredPropertyException
- If the provider needs a property which is not found in the property setjava.io.IOException
- If there is an IO problempublic java.lang.String getProviderInfo()
getProviderInfo
in interface WikiProvider
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.