Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.value.binary
Class InfinispanBinaryStore

    java.lang.Object
      org.modeshape.jcr.value.binary.AbstractBinaryStore
          org.modeshape.jcr.value.binary.InfinispanBinaryStore

All Implemented Interfaces:
  BinaryStore

    @ThreadSafe
    public class InfinispanBinaryStore

extends AbstractBinaryStore

A `BinaryStore` implementation that uses a database for persisting binary values.

Field Summary

Fields inherited from class org.modeshape.jcr.value.binary.AbstractBinaryStore
`MEDIUM_BUFFER_SIZE`

Fields inherited from interface org.modeshape.jcr.value.binary.BinaryStore
`DEFAULT_MINIMUM_BINARY_SIZE_IN_BYTES`

Constructor Summary
`InfinispanBinaryStore(String cacheName, org.infinispan.manager.CacheContainer cacheContainer)`

Method Summary
`org.infinispan.Cache<?,?>` | `getCache()`
`InputStream` | `getInputStream(BinaryKey key)` Get an `InputStream` to the binary content with the supplied key.
`String` | `getMimeType(BinaryValue binary, String name)` Get the MIME type for this binary value.
`String` | `getText(BinaryValue binary)` Get the text that can be extracted from this binary content.
`void` | `markAsUnused(Iterable<BinaryKey> keys)` Mark the supplied binary keys as unused, but key them in quarantine until needed again (at which point they're removed from quarantine) or until `BinaryStore.removeValuesUnusedLongerThan(long, TimeUnit)` is called.
`void` | `removeValuesUnusedLongerThan(long minimumAge, TimeUnit unit)` Remove binary values that have been `unused` for at least the specified amount of time.
`void` | `setContentCacheContainer(org.infinispan.manager.CacheContainer cacheContainer)` Set the `CacheContainer` this repository uses for content.
`void` | `setContentCacheName(String cacheName)` Set the name of the content cache.
`void` | `shutdown()`
`void` | `start()` Initialize the store with the name of the cache and the `CacheContainer` used for the content cache.
`BinaryValue` | `storeValue(InputStream stream)` Store the binary value and return the JCR representation.

Methods inherited from class org.modeshape.jcr.value.binary.AbstractBinaryStore
`bestBufferSize, detector, extractor, getMinimumBinarySizeInBytes, setMimeTypeDetector, setMinimumBinarySizeInBytes, setTextExtractor`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### InfinispanBinaryStore

    public InfinispanBinaryStore(String cacheName,
                                 org.infinispan.manager.CacheContainer cacheContainer)

Method Detail

### setContentCacheName

    public void setContentCacheName(String cacheName)

  Set the name of the content cache. This will be called before `start()`.

  Parameters:
    `cacheName` - the name of the cache this repository uses to store content; never null

### setContentCacheContainer

    public void setContentCacheContainer(org.infinispan.manager.CacheContainer cacheContainer)

  Set the `CacheContainer` this repository uses for content. This will be called before `start()`.

  Parameters:
    `cacheContainer` - the cache container this repository uses to store content; never null

### start

    public void start()

  Initialize the store with the name of the cache and the `CacheContainer` used for the content cache.

  Overrides:
    `start` in class `AbstractBinaryStore`

### shutdown

    public void shutdown()

  Overrides:
    `shutdown` in class `AbstractBinaryStore`

### getCache

    public org.infinispan.Cache<?,?> getCache()

### storeValue

    public BinaryValue storeValue(InputStream stream)
                           throws BinaryStoreException

  Description copied from interface: `BinaryStore`
  Store the binary value and return the JCR representation. Note that if the binary content in the supplied stream is already persisted in the store, the store may simply return the binary value referencing the existing content.

  Parameters:
    `stream` - the stream containing the binary content to be stored; may not be null
  Returns:
    the binary value representing the stored binary value; never null
  Throws:
    `BinaryStoreException`

### getInputStream

    public InputStream getInputStream(BinaryKey key)
                               throws BinaryStoreException

  Description copied from interface: `BinaryStore`
  Get an `InputStream` to the binary content with the supplied key.

  Parameters:
    `key` - the key to the binary content; never null
  Returns:
    the input stream through which the content can be read
  Throws:
    `BinaryStoreException` - if there is a problem reading the content from the store

### markAsUnused

    public void markAsUnused(Iterable<BinaryKey> keys)
                      throws BinaryStoreException

  Description copied from interface: `BinaryStore`
  Mark the supplied binary keys as unused, but key them in quarantine until needed again (at which point they're removed from quarantine) or until `BinaryStore.removeValuesUnusedLongerThan(long, TimeUnit)` is called. This method ignores any keys for values not stored within this store.

  Note that the implementation must never block.

  Parameters:
    `keys` - the keys for the binary values that are no longer needed
  Throws:
    `BinaryStoreException` - if there is a problem marking any of the supplied binary values as unused

### removeValuesUnusedLongerThan

    public void removeValuesUnusedLongerThan(long minimumAge,
                                             TimeUnit unit)
                                      throws BinaryStoreException

  Description copied from interface: `BinaryStore`
  Remove binary values that have been `unused` for at least the specified amount of time.

  Note that the implementation must never block.

  Parameters:
    `minimumAge` - the minimum time that a binary value has been `unused` before it can be removed; must be non-negative
    `unit` - the time unit for the minimum age; may not be null
  Throws:
    `BinaryStoreException` - if there is a problem removing the unused values

### getText

    public String getText(BinaryValue binary)
                   throws BinaryStoreException

  Description copied from interface: `BinaryStore`
  Get the text that can be extracted from this binary content.

  Parameters:
    `binary` - the binary content; may not be null
  Returns:
    the extracted text, or null if none could be extracted
  Throws:
    `BinaryStoreException` - if the binary content could not be accessed

### getMimeType

    public String getMimeType(BinaryValue binary,
                              String name)

  Description copied from interface: `BinaryStore`
  Get the MIME type for this binary value.

  Parameters:
    `binary` - the binary content; may not be null
    `name` - the name of the content, useful for determining the MIME type; may be null if not known
  Returns:
    the MIME type, or null if it cannot be determined (e.g., the Binary is empty)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.