org.infinispan.spring.support
Class InfinispanDefaultCacheFactoryBean<K,V>

java.lang.Object
  extended by org.infinispan.spring.support.InfinispanDefaultCacheFactoryBean<K,V>
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<Cache<K,V>>, org.springframework.beans.factory.InitializingBean

public class InfinispanDefaultCacheFactoryBean<K,V>
extends Object
implements org.springframework.beans.factory.FactoryBean<Cache<K,V>>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

A FactoryBean for creating a native default Infinispan org.infinispan.Cache , delegating to a configurable org.infinispan.manager.CacheContainer. A default Cache is a Cache that uses its CacheContainer's default settings. This is contrary to a named Cache where select settings from a CacheContainer's default configuration may be overridden with settings specific to that Cache.

In addition to creating a Cache this FactoryBean does also control that Cache's lifecycle by shutting it down when the enclosing Spring application context is closed. It is therefore advisable to always use this FactoryBean when creating a Cache.

Author:
Olaf Bergner

Field Summary
protected  Log logger
           
 
Constructor Summary
InfinispanDefaultCacheFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
          Shuts down the org.infinispan.Cache created by this FactoryBean.
 Cache<K,V> getObject()
           
 Class<? extends Cache> getObjectType()
           
 boolean isSingleton()
          Always returns true.
 void setInfinispanCacheContainer(CacheContainer infinispanCacheContainer)
           Sets the org.infinispan.manager.CacheContainer to be used for creating our Cache instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final Log logger
Constructor Detail

InfinispanDefaultCacheFactoryBean

public InfinispanDefaultCacheFactoryBean()
Method Detail

setInfinispanCacheContainer

public void setInfinispanCacheContainer(CacheContainer infinispanCacheContainer)

Sets the org.infinispan.manager.CacheContainer to be used for creating our Cache instance. Note that this is a mandatory property.

Parameters:
infinispanCacheContainer - The org.infinispan.manager.CacheContainer to be used for creating our Cache instance

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception
See Also:
InitializingBean.afterPropertiesSet()

getObject

public Cache<K,V> getObject()
                     throws Exception
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<Cache<K,V>>
Throws:
Exception
See Also:
FactoryBean.getObject()

getObjectType

public Class<? extends Cache> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<Cache<K,V>>
See Also:
FactoryBean.getObjectType()

isSingleton

public boolean isSingleton()
Always returns true.

Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<Cache<K,V>>
Returns:
Always true
See Also:
FactoryBean.isSingleton()

destroy

public void destroy()
             throws Exception
Shuts down the org.infinispan.Cache created by this FactoryBean.

Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
Exception
See Also:
DisposableBean.destroy(), Lifecycle.stop()

-->

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