Top Description Inners Fields Constructors Methods
com.sun.faces.spi

public Class InjectionProviderFactory

extends Object
Class Inheritance
Static Imports
java.util.logging.Level.WARNING

A factory for creating InjectionProvider instances.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
InjectionProviderFactory.NoopInjectionProvider

A no-op implementation of InjectionProvider which will be used when the #INJECTION_PROVIDER_PROPERTY is not specified or is invalid.

Field Summary

Modifier and TypeField and Description
private static final String[]
private static final InjectionProvider
private static final String
INJECTION_PROVIDER_PROPERTY

The system property that will be checked for alternate InjectionProvider implementations.

private static final String
private static final Logger
private static final InjectionProvider
NOOP_PROVIDER

Our no-op InjectionProvider.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static InjectionProvider

Returns:

an implementation of the InjectionProvider interfaces
createInstance
(ExternalContext
ExteranlContext for the current request
extContext
)

Creates a new instance of the class specified by the com.sun.faces.InjectionProvider system property.

private static boolean

Returns:

true if clazz implements the InjectionProvider interface
extendsDiscoverableInjectionProvider
(Class<?>
the class in question
clazz
)

Determine if the specified class extends the DiscoverableInjectionProvider interfaces.

private static String

Returns:

The provider class name specified in the container configuration, or null if not found.
findProviderClass
(ExternalContext
The ExternalContext for this request
extContext
)

Attempt to find an InjectionProvider based on the following algorithm:

  • Check for an explicit configuration within the web.xml using the key com.sun.faces.injectionProvider. If found, return the value.
  • Check for a system property keyed by com.sun.faces.InjectionProvider. If found, return the value.
  • Check for entries within META-INF/services/com.sun.faces.injectionprovider. If entries are found and the entries extend DiscoverableInjectionProvider, invoke isInjectionFeatureAvailable(String) passing in the configured delegate. If isInjectionFeatureAvailable(String) returns true return the service entry.
  • If no InjectionProviders are found, return null Tries to find a provider class in a web context parameter. If not present it tries to find it as a System property. If still not found returns null.
private static String
private static InjectionProvider
private static String[]
private static boolean

Returns:

true if clazz implements the InjectionProvider interface
implementsInjectionProvider
(Class<?>
the class in question
clazz
)

Determine if the specified class implements the InjectionProvider interfaces.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_ARRAYback to summary
private static final String[] EMPTY_ARRAY
GENERIC_WEB_PROVIDERback to summary
private static final InjectionProvider GENERIC_WEB_PROVIDER
INJECTION_PROVIDER_PROPERTYback to summary
private static final String INJECTION_PROVIDER_PROPERTY

The system property that will be checked for alternate InjectionProvider implementations.

INJECTION_SERVICEback to summary
private static final String INJECTION_SERVICE
LOGGERback to summary
private static final Logger LOGGER
NOOP_PROVIDERback to summary
private static final InjectionProvider NOOP_PROVIDER

Our no-op InjectionProvider.

Constructor Detail

InjectionProviderFactoryback to summary
public InjectionProviderFactory()

Method Detail

createInstanceback to summary
public static InjectionProvider createInstance(ExternalContext extContext)

Creates a new instance of the class specified by the com.sun.faces.InjectionProvider system property. If this propery is not defined, then a default, no-op, InjectionProvider will be returned.

Parameters
extContext:ExternalContext

ExteranlContext for the current request

Returns:InjectionProvider

an implementation of the InjectionProvider interfaces

extendsDiscoverableInjectionProviderback to summary
private static boolean extendsDiscoverableInjectionProvider(Class<?> clazz)

Determine if the specified class extends the DiscoverableInjectionProvider interfaces.

Parameters
clazz:Class<?>

the class in question

Returns:boolean

true if clazz implements the InjectionProvider interface

findProviderClassback to summary
private static String findProviderClass(ExternalContext extContext)

Attempt to find an InjectionProvider based on the following algorithm:

  • Check for an explicit configuration within the web.xml using the key com.sun.faces.injectionProvider. If found, return the value.
  • Check for a system property keyed by com.sun.faces.InjectionProvider. If found, return the value.
  • Check for entries within META-INF/services/com.sun.faces.injectionprovider. If entries are found and the entries extend DiscoverableInjectionProvider, invoke isInjectionFeatureAvailable(String) passing in the configured delegate. If isInjectionFeatureAvailable(String) returns true return the service entry.
  • If no InjectionProviders are found, return null
  • Tries to find a provider class in a web context parameter. If not present it tries to find it as a System property. If still not found returns null.
      Parameters
      extContext:ExternalContext

      The ExternalContext for this request

      Returns:String

      The provider class name specified in the container configuration, or null if not found.

getProviderFromEntryback to summary
private static String getProviderFromEntry(Map<String, Object> appMap, String entry)
getProviderInstanceback to summary
private static InjectionProvider getProviderInstance(String className, ExternalContext extContext)
getServiceEntriesback to summary
private static String[] getServiceEntries()
implementsInjectionProviderback to summary
private static boolean implementsInjectionProvider(Class<?> clazz)

Determine if the specified class implements the InjectionProvider interfaces.

Parameters
clazz:Class<?>

the class in question

Returns:boolean

true if clazz implements the InjectionProvider interface

com.sun.faces.spi back to summary

private final Class InjectionProviderFactory.NoopInjectionProvider

extends Object
implements InjectionProvider, AnnotationScanner
Class Inheritance
  • java.lang.Object
  • com.sun.faces.spi.InjectionProviderFactory.NoopInjectionProvider
All Implemented Interfaces
com.sun.faces.spi.AnnotationScanner, com.sun.faces.spi.InjectionProvider

A no-op implementation of InjectionProvider which will be used when the #INJECTION_PROVIDER_PROPERTY is not specified or is invalid.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Map<String, List<AnnotationScanner.ScannedAnnotation>>
public void
inject(Object
target ManagedBean
managedBean
)

Implements com.sun.faces.spi.InjectionProvider.inject.

This is a no-op.

public void
invokePostConstruct(Object
target ManagedBean
managedBean
)

Implements com.sun.faces.spi.InjectionProvider.invokePostConstruct.

This is a no-op.

public void
invokePreDestroy(Object
target ManagedBean
managedBean
)

Implements com.sun.faces.spi.InjectionProvider.invokePreDestroy.

This is a no-op.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

NoopInjectionProviderback to summary
private NoopInjectionProvider()

Method Detail

getAnnotatedClassesInCurrentModuleback to summary
public Map<String, List<AnnotationScanner.ScannedAnnotation>> getAnnotatedClassesInCurrentModule(ServletContext extContext) throws InjectionProviderException

Implements com.sun.faces.spi.AnnotationScanner.getAnnotatedClassesInCurrentModule.

Annotations
@Override
injectback to summary
public void inject(Object managedBean)

Implements com.sun.faces.spi.InjectionProvider.inject.

This is a no-op.

Parameters
managedBean:Object

target ManagedBean

Annotations
@Override
invokePostConstructback to summary
public void invokePostConstruct(Object managedBean) throws InjectionProviderException

Implements com.sun.faces.spi.InjectionProvider.invokePostConstruct.

This is a no-op.

Parameters
managedBean:Object

target ManagedBean

Annotations
@Override
Exceptions
InjectionProviderException:

Doc from com.sun.faces.spi.InjectionProvider.invokePostConstruct.

if an error occurs when invoking the method annotated by the @PostConstruct annotation

invokePreDestroyback to summary
public void invokePreDestroy(Object managedBean)

Implements com.sun.faces.spi.InjectionProvider.invokePreDestroy.

This is a no-op.

Parameters
managedBean:Object

target ManagedBean

Annotations
@Override