ro.isdc.wro.model.resource.support.naming
Class ConfigurableNamingStrategy

java.lang.Object
  extended by ro.isdc.wro.model.resource.support.AbstractConfigurableStrategySupport<S,P>
      extended by ro.isdc.wro.model.resource.support.AbstractConfigurableSingleStrategy<NamingStrategy,NamingStrategyProvider>
          extended by ro.isdc.wro.model.resource.support.naming.ConfigurableNamingStrategy
All Implemented Interfaces:
NamingStrategy

public class ConfigurableNamingStrategy
extends AbstractConfigurableSingleStrategy<NamingStrategy,NamingStrategyProvider>
implements NamingStrategy

Uses the NamingStrategy implementation associated with an alias read from properties file.

Since:
1.4.7
Author:
Alex Objelean

Field Summary
static String KEY
          Property name to specify namingStrategy alias.
 
Constructor Summary
ConfigurableNamingStrategy()
           
 
Method Summary
protected  NamingStrategy getDefaultStrategy()
          
protected  Class<NamingStrategyProvider> getProviderClass()
          
protected  Map<String,NamingStrategy> getStrategies(NamingStrategyProvider provider)
          
protected  String getStrategyKey()
          
 String rename(String originalName, InputStream inputStream)
          Creates a new name of the resource which encodes a version.
 
Methods inherited from class ro.isdc.wro.model.resource.support.AbstractConfigurableSingleStrategy
getConfiguredStrategy
 
Methods inherited from class ro.isdc.wro.model.resource.support.AbstractConfigurableStrategySupport
copyAll, getAvailableAliases, getAvailableStrategies, getConfiguredValue, getProviderFinder, getStrategyForAlias, newProperties, overrideDefaultStrategyMap, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY

public static final String KEY
Property name to specify namingStrategy alias.

See Also:
Constant Field Values
Constructor Detail

ConfigurableNamingStrategy

public ConfigurableNamingStrategy()
Method Detail

rename

public String rename(String originalName,
                     InputStream inputStream)
              throws IOException
Creates a new name of the resource which encodes a version.

Specified by:
rename in interface NamingStrategy
Parameters:
originalName - original name of the resource.
inputStream - the stream of the content to rename.
Returns:
new name of the resource with version encoded.
Throws:
IOException - if there are stream reading problem.

getDefaultStrategy

protected NamingStrategy getDefaultStrategy()

Specified by:
getDefaultStrategy in class AbstractConfigurableSingleStrategy<NamingStrategy,NamingStrategyProvider>
Returns:
the default strategy implementation to use when no key is configured is provided.

getStrategies

protected Map<String,NamingStrategy> getStrategies(NamingStrategyProvider provider)

Specified by:
getStrategies in class AbstractConfigurableStrategySupport<NamingStrategy,NamingStrategyProvider>
Parameters:
provider - the instance responsible for strategy lookup.
Returns:
the map of provided strategies.

getStrategyKey

protected String getStrategyKey()

Specified by:
getStrategyKey in class AbstractConfigurableStrategySupport<NamingStrategy,NamingStrategyProvider>
Returns:
the key of the strategy property.

getProviderClass

protected Class<NamingStrategyProvider> getProviderClass()

Overrides:
getProviderClass in class AbstractConfigurableStrategySupport<NamingStrategy,NamingStrategyProvider>
Returns:
the class of the provider of type P. Uses ParameterizedType to compute the class. Override it to support anonymous classes which do not play well with ParameterizedType's.


Copyright © 2008-2013. All Rights Reserved.