com.elasticpath.service.catalogview.impl
Class SingleCachingProductRetrieveStrategyImpl

java.lang.Object
  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.catalogview.impl.AbstractProductRetrieveStrategyImpl
          extended by com.elasticpath.service.catalogview.impl.SingleCachingProductRetrieveStrategyImpl
All Implemented Interfaces:
ProductRetrieveStrategy, EpService
Direct Known Subclasses:
RefreshableCachedProductRetrieveStrategyImpl

public class SingleCachingProductRetrieveStrategyImpl
extends AbstractProductRetrieveStrategyImpl
implements ProductRetrieveStrategy

Provides an implementation of ProductRetrieveStrategy with JBoss tree caching ability. This service will return the same instance of a product for all customers. Catalog promotion rules have already been applied on the returned products.

Notice: since the Product is not thread-safe, you must not make any changes on the return product in your code. Otherwise, the application may have some unexpected problem.


Nested Class Summary
 class SingleCachingProductRetrieveStrategyImpl.CacheKey
          Represents a key object used in the cache.
 
Constructor Summary
SingleCachingProductRetrieveStrategyImpl()
           
 
Method Summary
 Product retrieveProduct(long productUid, ShoppingCart shoppingCart, ProductLoadTuner productLoadTuner)
          Retrieve a Product with the given product uid.
 java.util.List retrieveProducts(java.util.Collection productUids, ShoppingCart shoppingCart, ProductLoadTuner productLoadTuner)
          Retrieve a list of Product of the given product uids.
 void start()
          Prepare the underlying JBossCache TreeCache instance.
 void stop()
          Stop the jboss cache.
 
Methods inherited from class com.elasticpath.service.catalogview.impl.AbstractProductRetrieveStrategyImpl
getProductService, setEpRuleEngine, setProductService
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpServiceImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Constructor Detail

SingleCachingProductRetrieveStrategyImpl

public SingleCachingProductRetrieveStrategyImpl()
Method Detail

retrieveProduct

public Product retrieveProduct(long productUid,
                               ShoppingCart shoppingCart,
                               ProductLoadTuner productLoadTuner)
Retrieve a Product with the given product uid. Return null if a product with the given uid doesn't exist or the product is not displayable.

Specified by:
retrieveProduct in interface ProductRetrieveStrategy
Parameters:
productUid - a product uid
shoppingCart - the customer shopping cart
productLoadTuner - the product load tuner
Returns:
a Product with the given product uid.

retrieveProducts

public java.util.List retrieveProducts(java.util.Collection productUids,
                                       ShoppingCart shoppingCart,
                                       ProductLoadTuner productLoadTuner)
Retrieve a list of Product of the given product uids. Only those products which are displayable are returned.

Specified by:
retrieveProducts in interface ProductRetrieveStrategy
Parameters:
productUids - a collection of product uids
shoppingCart - the customer shopping cart
productLoadTuner - the product load tuner
Returns:
a list of Product.

start

public void start()
Prepare the underlying JBossCache TreeCache instance.

Throws:
org.hibernate.cache.CacheException - Indicates a problem preparing cache for use.

stop

public void stop()
Stop the jboss cache.