Package org.apache.wiki.providers
Class CachingAttachmentProvider
- java.lang.Object
-
- org.apache.wiki.providers.CachingAttachmentProvider
-
- All Implemented Interfaces:
AttachmentProvider,WikiProvider
public class CachingAttachmentProvider extends java.lang.Object implements AttachmentProvider
Provides a caching attachment provider. This class rests on top of a real provider class and provides a cache to speed things up. Only the Attachment objects are cached; the actual attachment contents are fetched always from the provider.- Since:
- 2.1.64.
-
-
Field Summary
-
Fields inherited from interface org.apache.wiki.api.providers.AttachmentProvider
PROP_STORAGEDIR
-
Fields inherited from interface org.apache.wiki.api.providers.WikiProvider
LATEST_VERSION
-
-
Constructor Summary
Constructors Constructor Description CachingAttachmentProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteAttachment(Attachment att)voiddeleteVersion(Attachment att)java.util.Collection<Attachment>findAttachments(QueryItem[] query)java.io.InputStreamgetAttachmentData(Attachment att)AttachmentgetAttachmentInfo(Page page, java.lang.String name, int version)java.lang.StringgetProviderInfo()Gets the provider class name, and cache statistics (misscount and hitcount of the attachment cache).AttachmentProvidergetRealProvider()Returns the WikiAttachmentProvider that this caching provider delegates to.java.util.List<Attachment>getVersionHistory(Attachment att)voidinitialize(Engine engine, java.util.Properties properties)java.util.List<Attachment>listAllChanged(java.util.Date timestamp)java.util.List<Attachment>listAttachments(Page page)voidmoveAttachmentsForPage(java.lang.String oldParent, java.lang.String newParent)voidputAttachmentData(Attachment att, java.io.InputStream data)
-
-
-
Constructor Detail
-
CachingAttachmentProvider
public CachingAttachmentProvider()
-
-
Method Detail
-
initialize
public void initialize(Engine engine, java.util.Properties properties) throws NoRequiredPropertyException, java.io.IOException
- Specified by:
initializein interfaceWikiProvider- Throws:
NoRequiredPropertyExceptionjava.io.IOException
-
putAttachmentData
public void putAttachmentData(Attachment att, java.io.InputStream data) throws ProviderException, java.io.IOException
- Specified by:
putAttachmentDatain interfaceAttachmentProvider- Throws:
ProviderExceptionjava.io.IOException
-
getAttachmentData
public java.io.InputStream getAttachmentData(Attachment att) throws ProviderException, java.io.IOException
- Specified by:
getAttachmentDatain interfaceAttachmentProvider- Throws:
ProviderExceptionjava.io.IOException
-
listAttachments
public java.util.List<Attachment> listAttachments(Page page) throws ProviderException
- Specified by:
listAttachmentsin interfaceAttachmentProvider- Throws:
ProviderException
-
findAttachments
public java.util.Collection<Attachment> findAttachments(QueryItem[] query)
- Specified by:
findAttachmentsin interfaceAttachmentProvider
-
listAllChanged
public java.util.List<Attachment> listAllChanged(java.util.Date timestamp) throws ProviderException
- Specified by:
listAllChangedin interfaceAttachmentProvider- Throws:
ProviderException
-
getAttachmentInfo
public Attachment getAttachmentInfo(Page page, java.lang.String name, int version) throws ProviderException
- Specified by:
getAttachmentInfoin interfaceAttachmentProvider- Throws:
ProviderException
-
getVersionHistory
public java.util.List<Attachment> getVersionHistory(Attachment att)
- Specified by:
getVersionHistoryin interfaceAttachmentProvider
-
deleteVersion
public void deleteVersion(Attachment att) throws ProviderException
- Specified by:
deleteVersionin interfaceAttachmentProvider- Throws:
ProviderException
-
deleteAttachment
public void deleteAttachment(Attachment att) throws ProviderException
- Specified by:
deleteAttachmentin interfaceAttachmentProvider- Throws:
ProviderException
-
getProviderInfo
public java.lang.String getProviderInfo()
Gets the provider class name, and cache statistics (misscount and hitcount of the attachment cache).- Specified by:
getProviderInfoin interfaceWikiProvider- Returns:
- A plain string with all the above-mentioned values.
-
getRealProvider
public AttachmentProvider getRealProvider()
Returns the WikiAttachmentProvider that this caching provider delegates to.- Returns:
- The real provider underneath this one.
-
moveAttachmentsForPage
public void moveAttachmentsForPage(java.lang.String oldParent, java.lang.String newParent) throws ProviderException
- Specified by:
moveAttachmentsForPagein interfaceAttachmentProvider- Throws:
ProviderException
-
-