Search in sources :

Example 1 with FilterClassesFromFacesInitializerAnnotationProvider

use of com.sun.faces.config.manager.spi.FilterClassesFromFacesInitializerAnnotationProvider in project mojarra by eclipse-ee4j.

the class FindAnnotatedConfigClasses method call.

// ----------------------------------------------- Methods from Callable
@Override
public Map<Class<? extends Annotation>, Set<Class<?>>> call() throws Exception {
    Timer t = Timer.getInstance();
    if (t != null) {
        t.startTiming();
    }
    // We are executing on a different thread.
    facesContext.addInitContextEntryForCurrentThread();
    Set<URI> scanUris = null;
    com.sun.faces.spi.AnnotationScanner annotationScanner = metadataGetter.getAnnotationScanner();
    // This is where we discover what kind of InjectionProvider we have.
    if (provider instanceof FilterClassesFromFacesInitializerAnnotationProvider && annotationScanner != null) {
        // This InjectionProvider is capable of annotation scanning *and* injection.
        // Note that DelegatingAnnotationProvider itself doesn't use the provided scanner, but just uses the classes
        // that were already scanned by the ServletContainerInitializer and stored there.
        ((FilterClassesFromFacesInitializerAnnotationProvider) provider).setAnnotationScanner(annotationScanner, metadataGetter.getJarNames(annotatedSet));
        scanUris = emptySet();
    } else {
        // This InjectionProvider is capable of annotation scanning only
        scanUris = metadataGetter.getAnnotationScanURIs(annotatedSet);
    }
    // Note that DelegatingAnnotationProvider itself ignores the scanUris and directly gets the classes from the
    // ServletContext where they were stored by the ServletContainerInitializer
    Map<Class<? extends Annotation>, Set<Class<?>>> annotatedClasses = provider.getAnnotatedClasses(scanUris);
    if (t != null) {
        t.stopTiming();
        t.logResult("Configuration annotation scan complete.");
    }
    return annotatedClasses;
}
Also used : Collections.emptySet(java.util.Collections.emptySet) Set(java.util.Set) Timer(com.sun.faces.util.Timer) URI(java.net.URI) FilterClassesFromFacesInitializerAnnotationProvider(com.sun.faces.config.manager.spi.FilterClassesFromFacesInitializerAnnotationProvider) Annotation(java.lang.annotation.Annotation)

Aggregations

FilterClassesFromFacesInitializerAnnotationProvider (com.sun.faces.config.manager.spi.FilterClassesFromFacesInitializerAnnotationProvider)1 Timer (com.sun.faces.util.Timer)1 Annotation (java.lang.annotation.Annotation)1 URI (java.net.URI)1 Collections.emptySet (java.util.Collections.emptySet)1 Set (java.util.Set)1