|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ecyrd.jspwiki.providers.BasicAttachmentProvider
public class 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.pngThe 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 String |
ATTDIR_EXTENSION
|
static String |
DIR_EXTENSION
|
static String |
PROP_STORAGEDIR
|
static 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. |
Collection |
findAttachments(QueryItem[] query)
Finds attachments based on the query. |
InputStream |
getAttachmentData(Attachment att)
Get attachment data. |
Attachment |
getAttachmentInfo(WikiPage page,
String name,
int version)
Returns info about an attachment. |
protected static String |
getFileExtension(String filename)
Returns the file extension. |
String |
getProviderInfo()
Return a valid HTML string for information. |
List |
getVersionHistory(Attachment att)
Returns version history. |
void |
initialize(WikiEngine engine,
Properties properties)
Initializes the page provider. |
List |
listAllChanged(Date timestamp)
Lists changed attachments since given date. |
Collection |
listAttachments(WikiPage page)
Lists all attachments attached to a page. |
void |
moveAttachmentsForPage(String oldParent,
String newParent)
Move all the attachments for a given page so that they are attached to a new page. |
void |
putAttachmentData(Attachment att,
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 String PROP_STORAGEDIR
public static final String PROPERTY_FILE
public static final String DIR_EXTENSION
public static final String ATTDIR_EXTENSION
Constructor Detail |
---|
public BasicAttachmentProvider()
Method Detail |
---|
public void initialize(WikiEngine engine, Properties properties) throws NoRequiredPropertyException, IOException
WikiProvider
initialize
in interface WikiProvider
NoRequiredPropertyException
IOException
protected static String getFileExtension(String filename)
If file has no extension, will return "bin"
public void putAttachmentData(Attachment att, InputStream data) throws ProviderException, IOException
WikiAttachmentProvider
putAttachmentData
in interface WikiAttachmentProvider
ProviderException
IOException
public String getProviderInfo()
WikiProvider
getProviderInfo
in interface WikiProvider
public InputStream getAttachmentData(Attachment att) throws IOException, ProviderException
WikiAttachmentProvider
getAttachmentData
in interface WikiAttachmentProvider
IOException
ProviderException
public Collection listAttachments(WikiPage page) throws ProviderException
WikiAttachmentProvider
listAttachments
in interface WikiAttachmentProvider
ProviderException
public Collection findAttachments(QueryItem[] query)
WikiAttachmentProvider
findAttachments
in interface WikiAttachmentProvider
public List listAllChanged(Date timestamp) throws ProviderException
WikiAttachmentProvider
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
public Attachment getAttachmentInfo(WikiPage page, String name, int version) throws ProviderException
WikiAttachmentProvider
getAttachmentInfo
in interface WikiAttachmentProvider
ProviderException
public List getVersionHistory(Attachment att)
WikiAttachmentProvider
getVersionHistory
in interface WikiAttachmentProvider
public void deleteVersion(Attachment att) throws ProviderException
WikiAttachmentProvider
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
WikiAttachmentProvider
deleteAttachment
in interface WikiAttachmentProvider
att
- Attachment to delete.
ProviderException
- If the page could not be removed for some reason.public void moveAttachmentsForPage(String oldParent, String newParent) throws ProviderException
WikiAttachmentProvider
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |