org.apache.myfaces.spi
Class ServiceProviderFinder

java.lang.Object
  extended by org.apache.myfaces.spi.ServiceProviderFinder
Direct Known Subclasses:
DefaultServiceProviderFinder

public abstract class ServiceProviderFinder
extends Object

This class provides an interface to override SPI handling done by MyFaces. This is useful on environments like in OSGi, because it allows to put custom code to find SPI interfaces under META-INF/services/

Since:
2.0.3
Author:
Leonardo Uribe

Field Summary
static String[] KNOWN_SERVICES
           
 
Constructor Summary
ServiceProviderFinder()
           
 
Method Summary
 Map<String,List<String>> calculateKnownServiceProviderMapInfo(ExternalContext ectx, String[] knownServices)
           
abstract  List<String> getServiceProviderList(String spiClass)
          Gets the list of classes bound to the spiClass key, looking for entries under META-INF/services/[spiClass]
 void initKnownServiceProviderMapInfo(ExternalContext ectx, Map<String,List<String>> map)
          If ServiceProviderFinderFactory knows beforehand or has stored somewhere the known locations of the SPI interfaces, this method helps to set this config information so the implementation of this interface can use it.
<S> ServiceLoader<S>
load(Class<S> spiClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KNOWN_SERVICES

public static final String[] KNOWN_SERVICES
Constructor Detail

ServiceProviderFinder

public ServiceProviderFinder()
Method Detail

getServiceProviderList

public abstract List<String> getServiceProviderList(String spiClass)
Gets the list of classes bound to the spiClass key, looking for entries under META-INF/services/[spiClass]

Parameters:
spiClass -
Returns:

load

public <S> ServiceLoader<S> load(Class<S> spiClass)

initKnownServiceProviderMapInfo

public void initKnownServiceProviderMapInfo(ExternalContext ectx,
                                            Map<String,List<String>> map)
If ServiceProviderFinderFactory knows beforehand or has stored somewhere the known locations of the SPI interfaces, this method helps to set this config information so the implementation of this interface can use it. The idea is MyFaces initialization algorithm will call getKnownServiceProviderMapInfo method and if the value is not null it will call this method to pass the map back to the ServiceProviderFinder, so it can take it.

Parameters:
map -

calculateKnownServiceProviderMapInfo

public Map<String,List<String>> calculateKnownServiceProviderMapInfo(ExternalContext ectx,
                                                                     String[] knownServices)


Copyright © 2014 The Apache Software Foundation. All rights reserved.