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
`CachingAttachmentProvider()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `deleteAttachment​(Attachment att)`
`void` `deleteVersion​(Attachment att)`
`java.util.Collection<Attachment>` `findAttachments​(QueryItem[] query)`
`java.io.InputStream` `getAttachmentData​(Attachment att)`
`Attachment` `getAttachmentInfo​(Page page, java.lang.String name, int version)`
`java.lang.String` `getProviderInfo()` Gets the provider class name, and cache statistics (misscount and hitcount of the attachment cache).
`AttachmentProvider` `getRealProvider()` Returns the WikiAttachmentProvider that this caching provider delegates to.
`java.util.List<Attachment>` `getVersionHistory​(Attachment att)`
`void` `initialize​(Engine engine, java.util.Properties properties)`
`java.util.List<Attachment>` `listAllChanged​(java.util.Date timestamp)`
`java.util.List<Attachment>` `listAttachments​(Page page)`
`void` `moveAttachmentsForPage​(java.lang.String oldParent, java.lang.String newParent)`
`void` `putAttachmentData​(Attachment att, java.io.InputStream data)`

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

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

### Constructor Detail

#### CachingAttachmentProvider

    public CachingAttachmentProvider()

### Method Detail

#### initialize

    public void initialize​(Engine engine,
                           java.util.Properties properties)
                    throws NoRequiredPropertyException,
                           java.io.IOException

Specified by:
  `initialize` in interface `WikiProvider`
Throws:
  `NoRequiredPropertyException`
  `java.io.IOException`

#### putAttachmentData

    public void putAttachmentData​(Attachment att,
                                  java.io.InputStream data)
                           throws ProviderException,
                                  java.io.IOException

Specified by:
  `putAttachmentData` in interface `AttachmentProvider`
Throws:
  `ProviderException`
  `java.io.IOException`

#### getAttachmentData

    public java.io.InputStream getAttachmentData​(Attachment att)
                                          throws ProviderException,
                                                 java.io.IOException

Specified by:
  `getAttachmentData` in interface `AttachmentProvider`
Throws:
  `ProviderException`
  `java.io.IOException`

#### listAttachments

    public java.util.List<Attachment> listAttachments​(Page page)
                                               throws ProviderException

Specified by:
  `listAttachments` in interface `AttachmentProvider`
Throws:
  `ProviderException`

#### findAttachments

    public java.util.Collection<Attachment> findAttachments​(QueryItem[] query)

Specified by:
  `findAttachments` in interface `AttachmentProvider`

#### listAllChanged

    public java.util.List<Attachment> listAllChanged​(java.util.Date timestamp)
                                              throws ProviderException

Specified by:
  `listAllChanged` in interface `AttachmentProvider`
Throws:
  `ProviderException`

#### getAttachmentInfo

    public Attachment getAttachmentInfo​(Page page,
                                        java.lang.String name,
                                        int version)
                                 throws ProviderException

Specified by:
  `getAttachmentInfo` in interface `AttachmentProvider`
Throws:
  `ProviderException`

#### getVersionHistory

    public java.util.List<Attachment> getVersionHistory​(Attachment att)

Specified by:
  `getVersionHistory` in interface `AttachmentProvider`

#### deleteVersion

    public void deleteVersion​(Attachment att)
                       throws ProviderException

Specified by:
  `deleteVersion` in interface `AttachmentProvider`
Throws:
  `ProviderException`

#### deleteAttachment

    public void deleteAttachment​(Attachment att)
                          throws ProviderException

Specified by:
  `deleteAttachment` in interface `AttachmentProvider`
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:
  `getProviderInfo` in interface `WikiProvider`
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:
  `moveAttachmentsForPage` in interface `AttachmentProvider`
Throws:
  `ProviderException`