ro.isdc.wro.model.resource.locator.factory
Class ConfigurableLocatorFactory

java.lang.Object
  extended by ro.isdc.wro.model.resource.support.AbstractConfigurableStrategySupport<S,P>
      extended by ro.isdc.wro.model.resource.support.AbstractConfigurableMultipleStrategy<UriLocator,LocatorProvider>
          extended by ro.isdc.wro.model.resource.locator.factory.ConfigurableLocatorFactory
All Implemented Interfaces:
UriLocatorFactory

public class ConfigurableLocatorFactory
extends AbstractConfigurableMultipleStrategy<UriLocator,LocatorProvider>
implements UriLocatorFactory

A ProcessorsFactory implementation which is easy to configure using a Properties object.

Since:
1.4.0
Author:
Alex Objelean

Field Summary
static String PARAM_URI_LOCATORS
          Name of init param used to specify uri locators.
 
Constructor Summary
ConfigurableLocatorFactory()
           
 
Method Summary
 UriLocator getInstance(String uri)
          
protected  Class<LocatorProvider> getProviderClass()
          
protected  Map<String,UriLocator> getStrategies(LocatorProvider provider)
          
protected  String getStrategyKey()
          
 InputStream locate(String uri)
          Locates an InputStream for the given uri.
 
Methods inherited from class ro.isdc.wro.model.resource.support.AbstractConfigurableMultipleStrategy
createItemsAsString, getConfiguredStrategies
 
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

PARAM_URI_LOCATORS

public static final String PARAM_URI_LOCATORS
Name of init param used to specify uri locators.

See Also:
Constant Field Values
Constructor Detail

ConfigurableLocatorFactory

public ConfigurableLocatorFactory()
Method Detail

getStrategyKey

protected String getStrategyKey()

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

getStrategies

protected Map<String,UriLocator> getStrategies(LocatorProvider provider)

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

locate

public InputStream locate(String uri)
                   throws IOException
Locates an InputStream for the given uri.

Specified by:
locate in interface UriLocatorFactory
Parameters:
uri - to locate.
Returns:
InputStream of the resource.
Throws:
IOException - if uri is invalid or resource couldn't be located.

getInstance

public UriLocator getInstance(String uri)

Specified by:
getInstance in interface UriLocatorFactory
Parameters:
uri - to handle by the locator.
Returns:
an instance of UriLocator which is capable of handling provided uri. Returns null if no locator found.

getProviderClass

protected Class<LocatorProvider> getProviderClass()

Overrides:
getProviderClass in class AbstractConfigurableStrategySupport<UriLocator,LocatorProvider>
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.