Package org.apache.wiki.providers

# Class CachingAttachmentProvider

java.lang.Object
org.apache.wiki.providers.CachingAttachmentProvider

All Implemented Interfaces:
  `org.apache.wiki.api.providers.AttachmentProvider`, `org.apache.wiki.api.providers.WikiProvider`

public class CachingAttachmentProvider extends Object implements org.apache.wiki.api.providers.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

Modifier and Type
Method
Description
`void`
`deleteAttachment(org.apache.wiki.api.core.Attachment att)`
`void`
`deleteVersion(org.apache.wiki.api.core.Attachment att)`
`Collection<org.apache.wiki.api.core.Attachment>`
`findAttachments(org.apache.wiki.api.search.QueryItem[] query)`
`InputStream`
`getAttachmentData(org.apache.wiki.api.core.Attachment att)`
`org.apache.wiki.api.core.Attachment`
`getAttachmentInfo(org.apache.wiki.api.core.Page page, String name, int version)`
`String`
`getProviderInfo()`
Gets the provider class name, and cache statistics (misscount and hitcount of the attachment cache).
`org.apache.wiki.api.providers.AttachmentProvider`
`getRealProvider()`
Returns the WikiAttachmentProvider that this caching provider delegates to.
`List<org.apache.wiki.api.core.Attachment>`
`getVersionHistory(org.apache.wiki.api.core.Attachment att)`
`void`
`initialize(org.apache.wiki.api.core.Engine engine, Properties properties)`
`List<org.apache.wiki.api.core.Attachment>`
`listAllChanged(Date timestamp)`
`List<org.apache.wiki.api.core.Attachment>`
`listAttachments(org.apache.wiki.api.core.Page page)`
`void`
`moveAttachmentsForPage(String oldParent, String newParent)`
`void`
`putAttachmentData(org.apache.wiki.api.core.Attachment att, InputStream data)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CachingAttachmentProvider

public CachingAttachmentProvider()

## Method Details

### initialize

public void initialize(org.apache.wiki.api.core.Engine engine, Properties properties) throws org.apache.wiki.api.exceptions.NoRequiredPropertyException, IOException

Specified by:
  `initialize` in interface `org.apache.wiki.api.providers.WikiProvider`
Throws:
  `org.apache.wiki.api.exceptions.NoRequiredPropertyException`
  `IOException`

### putAttachmentData

public void putAttachmentData(org.apache.wiki.api.core.Attachment att, InputStream data) throws org.apache.wiki.api.exceptions.ProviderException, IOException

Specified by:
  `putAttachmentData` in interface `org.apache.wiki.api.providers.AttachmentProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`
  `IOException`

### getAttachmentData

public InputStream getAttachmentData(org.apache.wiki.api.core.Attachment att) throws org.apache.wiki.api.exceptions.ProviderException, IOException

Specified by:
  `getAttachmentData` in interface `org.apache.wiki.api.providers.AttachmentProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`
  `IOException`

### listAttachments

public List<org.apache.wiki.api.core.Attachment> listAttachments(org.apache.wiki.api.core.Page page) throws org.apache.wiki.api.exceptions.ProviderException

Specified by:
  `listAttachments` in interface `org.apache.wiki.api.providers.AttachmentProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### findAttachments

public Collection<org.apache.wiki.api.core.Attachment> findAttachments(org.apache.wiki.api.search.QueryItem[] query)

Specified by:
  `findAttachments` in interface `org.apache.wiki.api.providers.AttachmentProvider`

### listAllChanged

public List<org.apache.wiki.api.core.Attachment> listAllChanged(Date timestamp) throws org.apache.wiki.api.exceptions.ProviderException

Specified by:
  `listAllChanged` in interface `org.apache.wiki.api.providers.AttachmentProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### getAttachmentInfo

public org.apache.wiki.api.core.Attachment getAttachmentInfo(org.apache.wiki.api.core.Page page, String name, int version) throws org.apache.wiki.api.exceptions.ProviderException

Specified by:
  `getAttachmentInfo` in interface `org.apache.wiki.api.providers.AttachmentProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### getVersionHistory

public List<org.apache.wiki.api.core.Attachment> getVersionHistory(org.apache.wiki.api.core.Attachment att)

Specified by:
  `getVersionHistory` in interface `org.apache.wiki.api.providers.AttachmentProvider`

### deleteVersion

public void deleteVersion(org.apache.wiki.api.core.Attachment att) throws org.apache.wiki.api.exceptions.ProviderException

Specified by:
  `deleteVersion` in interface `org.apache.wiki.api.providers.AttachmentProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### deleteAttachment

public void deleteAttachment(org.apache.wiki.api.core.Attachment att) throws org.apache.wiki.api.exceptions.ProviderException

Specified by:
  `deleteAttachment` in interface `org.apache.wiki.api.providers.AttachmentProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### getProviderInfo

public String getProviderInfo()
Gets the provider class name, and cache statistics (misscount and hitcount of the attachment cache).

Specified by:
  `getProviderInfo` in interface `org.apache.wiki.api.providers.WikiProvider`
Returns:
  A plain string with all the above-mentioned values.

### getRealProvider

public org.apache.wiki.api.providers.AttachmentProvider getRealProvider()
Returns the WikiAttachmentProvider that this caching provider delegates to.

Returns:
  The real provider underneath this one.

### moveAttachmentsForPage

public void moveAttachmentsForPage(String oldParent, String newParent) throws org.apache.wiki.api.exceptions.ProviderException

Specified by:
  `moveAttachmentsForPage` in interface `org.apache.wiki.api.providers.AttachmentProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`