public Components(DeploymentUnit deploymentUnit, Map<ResourceRoot, Index> indexes) { componentDescriptionProcessors = ServiceLoader.load(ComponentDescriptionProcessor.class, WildFlySecurityManager.getClassLoaderPrivileged(BeanArchiveProcessor.class)); for (ComponentDescription component : deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION).getComponentDescriptions()) { ResourceRoot resourceRoot = null; DotName componentClassName = DotName.createSimple(component.getComponentClassName()); for (Entry<ResourceRoot, Index> entry : indexes.entrySet()) { final Index index = entry.getValue(); if (index != null) { if (index.getClassByName(componentClassName) != null) { resourceRoot = entry.getKey(); break; } } } if (resourceRoot == null) { implicitComponentDescriptions.add(component); } if (resourceRoot == null || isClassesRoot(resourceRoot)) { // special handling resourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); } componentDescriptions.put(resourceRoot, component); // Process component descriptions for (ComponentDescriptionProcessor processor : componentDescriptionProcessors) { processor.processComponentDescription(resourceRoot, component); } } }
@Override public void processComponentDescription(ResourceRoot resourceRoot, ComponentDescription component) { if (component instanceof EJBComponentDescription) { ejbComponentDescriptions.put(resourceRoot, (EJBComponentDescription) component); } }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedParameterMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_PARAMETER_ANNOTATIONS) { if (!method.getEnhancedParameters(annotation).isEmpty()) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedParameterMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_PARAMETER_ANNOTATIONS) { if (!method.getEnhancedParameters(annotation).isEmpty()) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedParameterMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_PARAMETER_ANNOTATIONS) { if (!method.getEnhancedParameters(annotation).isEmpty()) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedParameterMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_PARAMETER_ANNOTATIONS) { if (!method.getEnhancedParameters(annotation).isEmpty()) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedParameterMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_PARAMETER_ANNOTATIONS) { if (!method.getEnhancedParameters(annotation).isEmpty()) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedParameterMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_PARAMETER_ANNOTATIONS) { if (!method.getEnhancedParameters(annotation).isEmpty()) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_ANNOTATIONS) { if (method.isAnnotationPresent(annotation)) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_ANNOTATIONS) { if (method.isAnnotationPresent(annotation)) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_ANNOTATIONS) { if (method.isAnnotationPresent(annotation)) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_ANNOTATIONS) { if (method.isAnnotationPresent(annotation)) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_ANNOTATIONS) { if (method.isAnnotationPresent(annotation)) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
protected Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> buildAnnotatedMethodMultimap(Set<EnhancedAnnotatedMethod<?, ? super T>> effectiveMethods) { Multimap<Class<? extends Annotation>, EnhancedAnnotatedMethod<?, ? super T>> result = SetMultimap.newSetMultimap(); for (EnhancedAnnotatedMethod<?, ? super T> method : effectiveMethods) { for (Class<? extends Annotation> annotation : MAPPED_METHOD_ANNOTATIONS) { if (method.isAnnotationPresent(annotation)) { result.put(annotation, method); } } } return Multimaps.unmodifiableMultimap(result); }
/** * Merges bean interceptor bindings (including inherited ones) with method interceptor bindings. Method interceptor bindings * override bean interceptor bindings. The bean binding map is not modified - a copy is used. */ protected Multimap<Class<? extends Annotation>, Annotation> mergeMemberInterceptorBindings(Multimap<Class<? extends Annotation>, Annotation> beanBindings, Set<Annotation> methodBindingAnnotations) { Multimap<Class<? extends Annotation>, Annotation> mergedBeanBindings = SetMultimap.newSetMultimap(beanBindings); Multimap<Class<? extends Annotation>, Annotation> methodBindings = SetMultimap.newSetMultimap(); for (Annotation methodBinding : methodBindingAnnotations) { methodBindings.put(methodBinding.annotationType(), methodBinding); } for (Class<? extends Annotation> key : methodBindings.keySet()) { mergedBeanBindings.replaceValues(key, methodBindings.get(key)); } return mergedBeanBindings; }
/** * Merges bean interceptor bindings (including inherited ones) with method interceptor bindings. Method interceptor bindings * override bean interceptor bindings. The bean binding map is not modified - a copy is used. */ protected Multimap<Class<? extends Annotation>, Annotation> mergeMemberInterceptorBindings(Multimap<Class<? extends Annotation>, Annotation> beanBindings, Set<Annotation> methodBindingAnnotations) { Multimap<Class<? extends Annotation>, Annotation> mergedBeanBindings = SetMultimap.newSetMultimap(beanBindings); Multimap<Class<? extends Annotation>, Annotation> methodBindings = SetMultimap.newSetMultimap(); for (Annotation methodBinding : methodBindingAnnotations) { methodBindings.put(methodBinding.annotationType(), methodBinding); } for (Class<? extends Annotation> key : methodBindings.keySet()) { mergedBeanBindings.replaceValues(key, methodBindings.get(key)); } return mergedBeanBindings; }
/** * Merges bean interceptor bindings (including inherited ones) with method interceptor bindings. Method interceptor bindings * override bean interceptor bindings. The bean binding map is not modified - a copy is used. */ protected Multimap<Class<? extends Annotation>, Annotation> mergeMemberInterceptorBindings(Multimap<Class<? extends Annotation>, Annotation> beanBindings, Set<Annotation> methodBindingAnnotations) { Multimap<Class<? extends Annotation>, Annotation> mergedBeanBindings = SetMultimap.newSetMultimap(beanBindings); Multimap<Class<? extends Annotation>, Annotation> methodBindings = SetMultimap.newSetMultimap(); for (Annotation methodBinding : methodBindingAnnotations) { methodBindings.put(methodBinding.annotationType(), methodBinding); } for (Class<? extends Annotation> key : methodBindings.keySet()) { mergedBeanBindings.replaceValues(key, methodBindings.get(key)); } return mergedBeanBindings; }
/** * Merges bean interceptor bindings (including inherited ones) with method interceptor bindings. Method interceptor bindings * override bean interceptor bindings. The bean binding map is not modified - a copy is used. */ protected Multimap<Class<? extends Annotation>, Annotation> mergeMemberInterceptorBindings(Multimap<Class<? extends Annotation>, Annotation> beanBindings, Set<Annotation> methodBindingAnnotations) { Multimap<Class<? extends Annotation>, Annotation> mergedBeanBindings = SetMultimap.newSetMultimap(beanBindings); Multimap<Class<? extends Annotation>, Annotation> methodBindings = SetMultimap.newSetMultimap(); for (Annotation methodBinding : methodBindingAnnotations) { methodBindings.put(methodBinding.annotationType(), methodBinding); } for (Class<? extends Annotation> key : methodBindings.keySet()) { mergedBeanBindings.replaceValues(key, methodBindings.get(key)); } return mergedBeanBindings; }
/** * Merges bean interceptor bindings (including inherited ones) with method interceptor bindings. Method interceptor bindings * override bean interceptor bindings. The bean binding map is not modified - a copy is used. */ protected Multimap<Class<? extends Annotation>, Annotation> mergeMemberInterceptorBindings(Multimap<Class<? extends Annotation>, Annotation> beanBindings, Set<Annotation> methodBindingAnnotations) { Multimap<Class<? extends Annotation>, Annotation> mergedBeanBindings = SetMultimap.newSetMultimap(beanBindings); Multimap<Class<? extends Annotation>, Annotation> methodBindings = SetMultimap.newSetMultimap(); for (Annotation methodBinding : methodBindingAnnotations) { methodBindings.put(methodBinding.annotationType(), methodBinding); } for (Class<? extends Annotation> key : methodBindings.keySet()) { mergedBeanBindings.replaceValues(key, methodBindings.get(key)); } return mergedBeanBindings; }
private void validateEnabledAlternativeClasses(BeanManagerImpl beanManager, BeanDeployment deployment) { BeansXml beansXml = deployment.getBeanDeploymentArchive().getBeansXml(); if (beansXml != null && !beansXml.getEnabledAlternativeClasses().isEmpty()) { // prepare lookup structure Map<String, Class<?>> loadedClasses = buildClassNameMap(beanManager.getEnabled().getAlternativeClasses()); // lookup structure for validation of alternatives Multimap<Class<?>, Bean<?>> beansByClass = SetMultimap.newSetMultimap(); for (Bean<?> bean : beanManager.getDynamicAccessibleBeans()) { if (!(bean instanceof NewBean)) { beansByClass.put(bean.getBeanClass(), bean); } } for (Metadata<String> definition : beansXml.getEnabledAlternativeClasses()) { Class<?> enabledClass = loadedClasses.get(definition.getValue()); if (enabledClass.isAnnotation() || enabledClass.isInterface()) { throw ValidatorLogger.LOG.alternativeBeanClassNotClass(definition); } else { if (!isAlternativeBean(enabledClass, beansByClass) && !isAlternativeCandidate(enabledClass, beanManager)) { throw ValidatorLogger.LOG.alternativeBeanClassNotAnnotated(definition.getValue(), definition.getLocation()); } } } } }