ro.isdc.wro.manager
Class WroManager

java.lang.Object
  extended by ro.isdc.wro.manager.WroManager
All Implemented Interfaces:
WroConfigurationChangeListener

public class WroManager
extends Object
implements WroConfigurationChangeListener

Contains all the factories used by optimizer in order to perform the logic. This object should be created through WroManagerFactory, in order to ensure that all dependencies are injected properly. In other words, avoid setting the fields explicitly after creating a new instance of WroManager.

Most of the fields of this class are annotated with @Inject, in order to ensure that each instance can benefit use @Inject annotation on its fields.

Author:
Alex Objelean

Nested Class Summary
static class WroManager.Builder
           
 
Method Summary
 void destroy()
          Called when WroManager is being taken out of service.
 String encodeVersionIntoGroupPath(String groupName, ResourceType resourceType, boolean minimize)
          Encodes a fingerprint of the resource into the path.
protected  String formatVersionedResource(String hash, String resourcePath)
          Format the version of the resource in the path.
 CacheKeyFactory getCacheKeyFactory()
           
 CacheStrategy<CacheKey,CacheValue> getCacheStrategy()
           
 LifecycleCallbackRegistry getCallbackRegistry()
           
 GroupExtractor getGroupExtractor()
           
 HashStrategy getHashStrategy()
           
 MetaDataFactory getMetaDataFactory()
           
 WroModelFactory getModelFactory()
           
 NamingStrategy getNamingStrategy()
           
 ProcessorsFactory getProcessorsFactory()
           
 ResourceAuthorizationManager getResourceAuthorizationManager()
           
 UriLocatorFactory getUriLocatorFactory()
           
 void onCachePeriodChanged(long period)
          Invoked when the cachePeriod property is changed.
 void onModelPeriodChanged(long period)
          Invoked when the modelPeriod property is changed.
 void process()
          Perform processing of the uri.
 void registerCallback(LifecycleCallback callback)
          Deprecated. 
 void registerCallback(ObjectFactory<LifecycleCallback> callbackFactory)
          Registers a callback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

process

public final void process()
                   throws IOException
Perform processing of the uri.

Throws:
IOException - when any IO related problem occurs or if the request cannot be processed.

encodeVersionIntoGroupPath

public final String encodeVersionIntoGroupPath(String groupName,
                                               ResourceType resourceType,
                                               boolean minimize)
Encodes a fingerprint of the resource into the path. The result may look like this: ${fingerprint}/myGroup.js

Returns:
a path to the resource with the fingerprint encoded as a folder name.

formatVersionedResource

protected String formatVersionedResource(String hash,
                                         String resourcePath)
Format the version of the resource in the path. Default implementation use hash as a folder: /groupName.js. The implementation can be changed to follow a different versioning style, like version parameter: /groupName.js?version=

Parameters:
hash - Hash of the resource.
resourcePath - Path of the resource.
Returns:
formatted versioned path of the resource.

onCachePeriodChanged

public final 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 final 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.

destroy

public final void destroy()
Called when WroManager is being taken out of service.


getHashStrategy

public final HashStrategy getHashStrategy()

getModelFactory

public final WroModelFactory getModelFactory()
Returns:
the modelFactory

getProcessorsFactory

public final ProcessorsFactory getProcessorsFactory()
Returns:
the processorsFactory used by this WroManager.

getCacheStrategy

public final CacheStrategy<CacheKey,CacheValue> getCacheStrategy()
Returns:
the cacheStrategy

getUriLocatorFactory

public final UriLocatorFactory getUriLocatorFactory()
Returns:
the uriLocatorFactory

getNamingStrategy

public final NamingStrategy getNamingStrategy()
Returns:
The strategy used to rename bundled resources.

getGroupExtractor

public final GroupExtractor getGroupExtractor()

getCacheKeyFactory

public CacheKeyFactory getCacheKeyFactory()

getMetaDataFactory

public MetaDataFactory getMetaDataFactory()

registerCallback

@Deprecated
public final void registerCallback(LifecycleCallback callback)
Deprecated. 

Registers a callback.

Parameters:
callback - LifecycleCallback to register.

registerCallback

public final void registerCallback(ObjectFactory<LifecycleCallback> callbackFactory)
Registers a callback.

Parameters:
callbackFactory - ObjectFactory responsible for creating LifecycleCallback instance.

getCallbackRegistry

public LifecycleCallbackRegistry getCallbackRegistry()

getResourceAuthorizationManager

public ResourceAuthorizationManager getResourceAuthorizationManager()


Copyright © 2008-2013. All Rights Reserved.