*
* @param interceptorsElement interceptors element
*/
private void configureInterceptorsElement(Element interceptorsElement, String fileName, ScannerService scanner)
{
WebBeansContext webBeansContext = WebBeansContext.getInstance();
InterceptorsManager manager = webBeansContext.getInterceptorsManager();
Node node;
Element child;
// the interceptors in this beans.xml
// this gets used to detect multiple definitions of the
// same interceptor in one beans.xml file.
Set<Class> interceptorsInFile = new HashSet<Class>();
NodeList ns = interceptorsElement.getChildNodes();
for (int i = 0; i < ns.getLength(); i++)
{
node = ns.item(i);
if (!(node instanceof Element))
{
continue;
}
child = (Element) node;
Class<?> clazz = null;
clazz = ClassUtil.getClassFromName(child.getTextContent().trim());
if (clazz == null)
{
throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Interceptor class : " +
child.getTextContent().trim() + " not found");
}
else
{
Annotation[] classAnnotations;
AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz);
ProcessAnnotatedTypeImpl<?> processAnnotatedEvent =
webBeansContext.getWebBeansUtil().fireProcessAnnotatedTypeEvent(annotatedType);
// if veto() is called
if (processAnnotatedEvent.isVeto())
{
return;
}
annotatedType = processAnnotatedEvent.getAnnotatedType();
Set<Annotation> annTypeAnnotations = annotatedType.getAnnotations();
if (annTypeAnnotations != null)
{
classAnnotations = annTypeAnnotations.toArray(new Annotation[annTypeAnnotations.size()]);
}
else
{
classAnnotations = new Annotation[0];
}
if (AnnotationUtil.hasAnnotation(classAnnotations, Interceptor.class) &&
!webBeansContext.getAnnotationManager().
hasInterceptorBindingMetaAnnotation(classAnnotations))
{
throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Interceptor class : "
+ child.getTextContent().trim()
+ " must have at least one @InterceptorBinding");