org.infinispan.loader.s3
Class S3CacheStore

java.lang.Object
  extended by org.infinispan.loader.AbstractCacheLoader
      extended by org.infinispan.loader.AbstractCacheStore
          extended by org.infinispan.loader.LockSupportCacheStore
              extended by org.infinispan.loader.bucket.BucketBasedCacheStore
                  extended by org.infinispan.loader.s3.S3CacheStore
All Implemented Interfaces:
CacheLoader, CacheStore

public class S3CacheStore
extends BucketBasedCacheStore

A TODO link implementation of a BucketBasedCacheStore. This file store stores stuff in the following format: http://s3.amazon.com/{bucket}/bucket_number.bucket

Since:
4.0
Author:
Adrian Cole

Constructor Summary
S3CacheStore()
           
 
Method Summary
protected  void clearLockSafe()
           
protected  void fromStreamLockSafe(ObjectInput objectInput)
           
 Class<? extends CacheLoaderConfig> getConfigurationClass()
           
 void init(CacheLoaderConfig config, Cache cache, Marshaller m)
          Used to initialize a cache loader. This initializes the internal s3Connection to a default implementation
 void init(CacheLoaderConfig config, Cache cache, Marshaller m, S3Connection connection, S3Bucket bucket)
           
protected  void insertBucket(Bucket bucket)
           
protected  Set<InternalCacheEntry> loadAllLockSafe()
           
protected  Bucket loadBucket(String bucketName)
          Loads the bucket from the store, base on the hashcode.
protected  void purgeInternal()
           
protected  void saveBucket(Bucket bucket)
          This method assumes that the bucket is already persisted in the database.
 void start()
           
 void stop()
           
protected  void toStreamLockSafe(ObjectOutput objectOutput)
           
 
Methods inherited from class org.infinispan.loader.bucket.BucketBasedCacheStore
getLockFromKey, loadLockSafe, removeLockSafe, storeLockSafe
 
Methods inherited from class org.infinispan.loader.LockSupportCacheStore
acquireGlobalLock, clear, fromStream, getTotalLockCount, immediateLockForWritting, load, loadAll, lockForReading, lockForWritting, releaseGlobalLock, remove, store, toStream, unlock
 
Methods inherited from class org.infinispan.loader.AbstractCacheStore
applyModifications, commit, getMarshaller, prepare, purgeExpired, removeAll, rollback, safeClose, safeClose
 
Methods inherited from class org.infinispan.loader.AbstractCacheLoader
containsKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.infinispan.loader.CacheLoader
containsKey
 

Constructor Detail

S3CacheStore

public S3CacheStore()
Method Detail

getConfigurationClass

public Class<? extends CacheLoaderConfig> getConfigurationClass()
Returns:
the type of the CacheLoaderConfig bean used to configure this implementation of CacheLoader

init

public void init(CacheLoaderConfig config,
                 Cache cache,
                 Marshaller m)
Used to initialize a cache loader. Typically invoked by the CacheLoaderManager when setting up cache loaders. This initializes the internal s3Connection to a default implementation

Specified by:
init in interface CacheLoader
Overrides:
init in class LockSupportCacheStore
Parameters:
config - the cache loader configuration bean
cache - cache associated with this cache loader. Implementations may use this to determine cache name when selecting where refer to state in storage, for example, a different database table name.
m - marshaller to use when loading state from a stream, if supported by the implementation.

stop

public void stop()
          throws CacheLoaderException
Specified by:
stop in interface CacheLoader
Overrides:
stop in class AbstractCacheStore
Throws:
CacheLoaderException

init

public void init(CacheLoaderConfig config,
                 Cache cache,
                 Marshaller m,
                 S3Connection connection,
                 S3Bucket bucket)

start

public void start()
           throws CacheLoaderException
Specified by:
start in interface CacheLoader
Overrides:
start in class LockSupportCacheStore
Throws:
CacheLoaderException

loadAllLockSafe

protected Set<InternalCacheEntry> loadAllLockSafe()
                                           throws CacheLoaderException
Specified by:
loadAllLockSafe in class LockSupportCacheStore
Throws:
CacheLoaderException

fromStreamLockSafe

protected void fromStreamLockSafe(ObjectInput objectInput)
                           throws CacheLoaderException
Specified by:
fromStreamLockSafe in class LockSupportCacheStore
Throws:
CacheLoaderException

toStreamLockSafe

protected void toStreamLockSafe(ObjectOutput objectOutput)
                         throws CacheLoaderException
Specified by:
toStreamLockSafe in class LockSupportCacheStore
Throws:
CacheLoaderException

clearLockSafe

protected void clearLockSafe()
                      throws CacheLoaderException
Specified by:
clearLockSafe in class LockSupportCacheStore
Throws:
CacheLoaderException

purgeInternal

protected void purgeInternal()
                      throws CacheLoaderException
Overrides:
purgeInternal in class AbstractCacheStore
Throws:
CacheLoaderException

loadBucket

protected Bucket loadBucket(String bucketName)
                     throws CacheLoaderException
Description copied from class: BucketBasedCacheStore
Loads the bucket from the store, base on the hashcode.

Specified by:
loadBucket in class BucketBasedCacheStore
Throws:
CacheLoaderException

insertBucket

protected void insertBucket(Bucket bucket)
                     throws CacheLoaderException
Specified by:
insertBucket in class BucketBasedCacheStore
Throws:
CacheLoaderException

saveBucket

protected void saveBucket(Bucket bucket)
                   throws CacheLoaderException
Description copied from class: BucketBasedCacheStore
This method assumes that the bucket is already persisted in the database.

Specified by:
saveBucket in class BucketBasedCacheStore
Throws:
CacheLoaderException - if the bucket is not already present, or something happens while persisting.


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.