001/* 002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 */ 018package org.nuxeo.ecm.platform.ui.web.application.config; 019 020import java.lang.annotation.Annotation; 021import java.net.URI; 022import java.util.Map; 023import java.util.Set; 024 025import javax.servlet.ServletContext; 026 027import org.apache.commons.logging.LogFactory; 028 029import com.sun.faces.spi.AnnotationProvider; 030 031/** 032 * TODO. 033 * 034 * @since 6.0 035 */ 036public class JSFAnnotationProvider extends AnnotationProvider { 037 038 protected final AnnotationProvider base; 039 040 public JSFAnnotationProvider(ServletContext sc, AnnotationProvider aProvider) { 041 super(sc); 042 base = aProvider; 043 } 044 045 @Override 046 public Map<Class<? extends Annotation>, Set<Class<?>>> getAnnotatedClasses(Set<URI> urls) { 047 if (JSFContainerInitializer.self == null) { 048 LogFactory.getLog(JSFAnnotationProvider.class).warn( 049 "container scanned classes unavailable, applying default scanning"); 050 return base.getAnnotatedClasses(urls); 051 } 052 return JSFContainerInitializer.self.index; 053 } 054 055}