Class ExoCacheFactoryImpl

  • All Implemented Interfaces:
    org.exoplatform.services.cache.ExoCacheFactory, org.picocontainer.Startable

    public class ExoCacheFactoryImpl
    extends Object
    implements org.exoplatform.services.cache.ExoCacheFactory, org.picocontainer.Startable
    This class is the Infinispan implementation of the ExoCacheFactory
    Version:
    $Id$
    Author:
    Nicolas Filotto
    • Constructor Summary

      Constructors 
      Constructor Description
      ExoCacheFactoryImpl​(org.exoplatform.container.ExoContainerContext ctx, String cacheConfigTemplate, String cacheAsyncConfigTemplate, org.exoplatform.container.configuration.ConfigurationManager configManager, DistributedCacheManager dcm)  
      ExoCacheFactoryImpl​(org.exoplatform.container.ExoContainerContext ctx, org.exoplatform.container.xml.InitParams params, org.exoplatform.container.configuration.ConfigurationManager configManager)  
      ExoCacheFactoryImpl​(org.exoplatform.container.ExoContainerContext ctx, org.exoplatform.container.xml.InitParams params, org.exoplatform.container.configuration.ConfigurationManager configManager, DistributedCacheManager dcm)  
    • Constructor Detail

      • ExoCacheFactoryImpl

        public ExoCacheFactoryImpl​(org.exoplatform.container.ExoContainerContext ctx,
                                   org.exoplatform.container.xml.InitParams params,
                                   org.exoplatform.container.configuration.ConfigurationManager configManager)
                            throws org.exoplatform.services.cache.ExoCacheInitException
        Throws:
        org.exoplatform.services.cache.ExoCacheInitException
      • ExoCacheFactoryImpl

        public ExoCacheFactoryImpl​(org.exoplatform.container.ExoContainerContext ctx,
                                   org.exoplatform.container.xml.InitParams params,
                                   org.exoplatform.container.configuration.ConfigurationManager configManager,
                                   DistributedCacheManager dcm)
                            throws org.exoplatform.services.cache.ExoCacheInitException
        Throws:
        org.exoplatform.services.cache.ExoCacheInitException
      • ExoCacheFactoryImpl

        public ExoCacheFactoryImpl​(org.exoplatform.container.ExoContainerContext ctx,
                                   String cacheConfigTemplate,
                                   String cacheAsyncConfigTemplate,
                                   org.exoplatform.container.configuration.ConfigurationManager configManager,
                                   DistributedCacheManager dcm)
                            throws org.exoplatform.services.cache.ExoCacheInitException
        Throws:
        org.exoplatform.services.cache.ExoCacheInitException
    • Method Detail

      • createCache

        public org.exoplatform.services.cache.ExoCache<Serializable,​Object> createCache​(org.exoplatform.services.cache.ExoCacheConfig config)
                                                                                       throws org.exoplatform.services.cache.ExoCacheInitException
        To create a new cache instance according to the given configuration, we follow the steps below: We first try to find if a specific location of the cache configuration has been defined thanks to an external component plugin of type ExoCacheFactoryConfigPlugin. If so we use the default cache configuration defined in this file otherwise we use the default cache configuration defined in "${CACHE_CONFIG_TEMPLATE_KEY}"
        Specified by:
        createCache in interface org.exoplatform.services.cache.ExoCacheFactory
        Throws:
        org.exoplatform.services.cache.ExoCacheInitException
      • addCreator

        public void addCreator​(ExoCacheCreatorPlugin plugin)
        Add a list of creators to register
        Parameters:
        plugin - the plugin that contains the creators
      • addConfig

        public void addConfig​(ExoCacheFactoryConfigPlugin plugin)
        Add a list of custom configuration to register
        Parameters:
        plugin - the plugin that contains the configs
      • start

        public void start()
        Specified by:
        start in interface org.picocontainer.Startable
      • stop

        public void stop()
        Specified by:
        stop in interface org.picocontainer.Startable
      • getExoCacheCreator

        protected ExoCacheCreator getExoCacheCreator​(org.exoplatform.services.cache.ExoCacheConfig config)
        Returns the most relevant ExoCacheCreator according to the give configuration
      • resetConfiguration

        protected void resetConfiguration​(org.infinispan.configuration.cache.ConfigurationBuilder confBuilder)
        Clean the configuration template to prevent conflicts