}
@Override
public InjectionProvider getInjectionProvider(ExternalContext externalContext)
{
InjectionProvider lifecycleProvider = null;
if (externalContext == null)
{
// Really in jsf 2.0, this will not happen, because a Startup/Shutdown
// FacesContext and ExternalContext are provided on initialization and shutdown,
// and in other scenarios the real FacesContext/ExternalContext is provided.
log.info("No ExternalContext using fallback InjectionProvider.");
lifecycleProvider = resolveFallbackInjectionProvider();
}
else
{
lifecycleProvider = (InjectionProvider)
externalContext.getApplicationMap().get(INJECTION_PROVIDER_INSTANCE_KEY);
}
if (lifecycleProvider == null)
{
if (!resolveInjectionProviderFromExternalContext(externalContext))
{
if (!resolveInjectionProviderFromService(externalContext))
{
lifecycleProvider = resolveFallbackInjectionProvider();
externalContext.getApplicationMap().put(INJECTION_PROVIDER_INSTANCE_KEY, lifecycleProvider);
}
else
{
//Retrieve it because it was resolved
lifecycleProvider = (InjectionProvider)
externalContext.getApplicationMap().get(INJECTION_PROVIDER_INSTANCE_KEY);
}
}
else
{
//Retrieve it because it was resolved
lifecycleProvider = (InjectionProvider)
externalContext.getApplicationMap().get(INJECTION_PROVIDER_INSTANCE_KEY);
}
log.info("Using InjectionProvider "+ lifecycleProvider.getClass().getName());
}
return lifecycleProvider;
}