ro.isdc.wro.manager.factory
Class BaseWroManagerFactory

java.lang.Object
  extended by ro.isdc.wro.manager.factory.BaseWroManagerFactory
All Implemented Interfaces:
WroConfigurationChangeListener, WroManagerFactory, ObjectFactory<WroManager>
Direct Known Subclasses:
ConfigurableWroManagerFactory, NoProcessorsWroManagerFactory, StandaloneWroManagerFactory

public class BaseWroManagerFactory
extends Object
implements WroManagerFactory

Default implementation of WroManagerFactory which creates default locators and processors and handles the injection logic by creating an Injector and injecting where it is appropriate.

Author:
Alex Objelean

Constructor Summary
BaseWroManagerFactory()
           
 
Method Summary
 BaseWroManagerFactory addModelTransformer(Transformer<WroModel> modelTransformer)
          Add a single model transformer.
 WroManager create()
          Creates default singleton instance of manager, by initializing manager dependencies with default values (processors).
 void destroy()
          Called by filter indicating that it is being taken out of service.
protected  ResourceAuthorizationManager newAuthorizationManager()
           
protected  CacheKeyFactory newCacheKeyFactory()
           
protected  CacheStrategy<CacheKey,CacheValue> newCacheStrategy()
           
protected  GroupExtractor newGroupExtractor()
           
protected  HashStrategy newHashStrategy()
           
protected  MetaDataFactory newMetaDataFactory()
           
protected  WroModelFactory newModelFactory()
           
protected  List<Transformer<WroModel>> newModelTransformers()
           
protected  NamingStrategy newNamingStrategy()
           
protected  ProcessorsFactory newProcessorsFactory()
          Override to provide a different or modified default factory implementation.
protected  UriLocatorFactory newUriLocatorFactory()
          Override to provide a different or modified factory.
protected  void onAfterInitializeManager(WroManager manager)
          Allows factory to do additional manager configuration after it was initialzed.
 void onCachePeriodChanged(long period)
          Invoked when the cachePeriod property is changed.
 void onModelPeriodChanged(long period)
          Invoked when the modelPeriod property is changed.
 void setCacheKeyFactory(CacheKeyFactory cacheKeyFactory)
           
 BaseWroManagerFactory setCacheStrategy(CacheStrategy<CacheKey,CacheValue> cacheStrategy)
           
 BaseWroManagerFactory setGroupExtractor(GroupExtractor groupExtractor)
           
 BaseWroManagerFactory setHashBuilder(HashStrategy hashBuilder)
          Deprecated. use setHashStrategy(HashStrategy)
 BaseWroManagerFactory setHashStrategy(HashStrategy hashStrategy)
           
 void setMetaDataFactory(MetaDataFactory metaDataFactory)
           
 BaseWroManagerFactory setModelFactory(WroModelFactory modelFactory)
           
 BaseWroManagerFactory setModelTransformers(List<Transformer<WroModel>> modelTransformers)
           
 BaseWroManagerFactory setNamingStrategy(NamingStrategy namingStrategy)
           
 void setProcessorsFactory(ProcessorsFactory processorsFactory)
           
 BaseWroManagerFactory setResourceAuthorizationManager(ResourceAuthorizationManager authorizationManager)
           
 BaseWroManagerFactory setUriLocatorFactory(UriLocatorFactory uriLocatorFactory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseWroManagerFactory

public BaseWroManagerFactory()
Method Detail

create

public final WroManager create()
Creates default singleton instance of manager, by initializing manager dependencies with default values (processors).

Specified by:
create in interface ObjectFactory<WroManager>

newAuthorizationManager

protected ResourceAuthorizationManager newAuthorizationManager()
Returns:
default implementation of ResourceAuthorizationManager.

onAfterInitializeManager

protected void onAfterInitializeManager(WroManager manager)
Allows factory to do additional manager configuration after it was initialzed. One use-case is to configure callbacks. Default implementation does nothing. Do not set anything else except callbacks in this method, otherwise the initialization will not be performed properly.

Parameters:
manager - initialized instance of WroManager.

setNamingStrategy

public BaseWroManagerFactory setNamingStrategy(NamingStrategy namingStrategy)
Parameters:
namingStrategy - the namingStrategy to set

newModelTransformers

protected List<Transformer<WroModel>> newModelTransformers()
Returns:
default implementation of modelTransformers.

newProcessorsFactory

protected ProcessorsFactory newProcessorsFactory()
Override to provide a different or modified default factory implementation.

Returns:
ProcessorsFactory object.

newUriLocatorFactory

protected UriLocatorFactory newUriLocatorFactory()
Override to provide a different or modified factory.

Returns:
UriLocatorFactory object.

newHashStrategy

protected HashStrategy newHashStrategy()
Returns:
HashStrategy instance.

newNamingStrategy

protected NamingStrategy newNamingStrategy()
Returns:
default NamingStrategy to be used by this WroManagerFactory

onCachePeriodChanged

public void onCachePeriodChanged(long period)
Invoked when the cachePeriod property is changed.

Specified by:
onCachePeriodChanged in interface WroConfigurationChangeListener
Parameters:
period - number of seconds used by scheduler to trigger cache change.

onModelPeriodChanged

public void onModelPeriodChanged(long period)
Invoked when the modelPeriod property is changed.

Specified by:
onModelPeriodChanged in interface WroConfigurationChangeListener
Parameters:
period - number of seconds used by scheduler to trigger model change.

newCacheStrategy

protected CacheStrategy<CacheKey,CacheValue> newCacheStrategy()
Returns:
CacheStrategy instance for resources' group caching.

newGroupExtractor

protected GroupExtractor newGroupExtractor()
Returns:
GroupExtractor implementation.

newCacheKeyFactory

protected CacheKeyFactory newCacheKeyFactory()
Returns:
default implementation of CacheKeyFactory.

newModelFactory

protected WroModelFactory newModelFactory()
Parameters:
servletContext - ServletContext which could be useful for creating dynamic WroModel.
Returns:
WroModelFactory implementation

newMetaDataFactory

protected MetaDataFactory newMetaDataFactory()
Returns:
default implementation of MetaDataFactory used when no MetaDataFactory is set.

setGroupExtractor

public BaseWroManagerFactory setGroupExtractor(GroupExtractor groupExtractor)
Parameters:
groupExtractor - the groupExtractor to set

setModelFactory

public BaseWroManagerFactory setModelFactory(WroModelFactory modelFactory)
Parameters:
modelFactory - the modelFactory to set

setHashBuilder

@Deprecated
public BaseWroManagerFactory setHashBuilder(HashStrategy hashBuilder)
Deprecated. use setHashStrategy(HashStrategy)

Parameters:
hashBuilder - the hashBuilder to set

setHashStrategy

public BaseWroManagerFactory setHashStrategy(HashStrategy hashStrategy)
Parameters:
hashBuilder - the hashBuilder to set

setCacheKeyFactory

public void setCacheKeyFactory(CacheKeyFactory cacheKeyFactory)

setModelTransformers

public BaseWroManagerFactory setModelTransformers(List<Transformer<WroModel>> modelTransformers)
Parameters:
modelTransformers - the modelTransformers to set

addModelTransformer

public BaseWroManagerFactory addModelTransformer(Transformer<WroModel> modelTransformer)
Add a single model transformer.


setCacheStrategy

public BaseWroManagerFactory setCacheStrategy(CacheStrategy<CacheKey,CacheValue> cacheStrategy)
Parameters:
cacheStrategy - the cacheStrategy to set

setUriLocatorFactory

public BaseWroManagerFactory setUriLocatorFactory(UriLocatorFactory uriLocatorFactory)
Parameters:
uriLocatorFactory - the uriLocatorFactory to set

setProcessorsFactory

public void setProcessorsFactory(ProcessorsFactory processorsFactory)
Parameters:
processorsFactory - the processorsFactory to set

setResourceAuthorizationManager

public BaseWroManagerFactory setResourceAuthorizationManager(ResourceAuthorizationManager authorizationManager)

setMetaDataFactory

public void setMetaDataFactory(MetaDataFactory metaDataFactory)

destroy

public void destroy()
Called by filter indicating that it is being taken out of service.

Specified by:
destroy in interface WroManagerFactory


Copyright © 2008-2013. All Rights Reserved.