use of org.jboss.as.ee.component.EEModuleClassDescription in project wildfly by wildfly.
the class AroundTimeoutAnnotationParsingProcessor method processAroundInvoke.
private void processAroundInvoke(final AnnotationTarget target, final EEModuleDescription eeModuleDescription) {
if (!(target instanceof MethodInfo)) {
throw EjbLogger.ROOT_LOGGER.annotationApplicableOnlyForMethods(AROUND_TIMEOUT_ANNOTATION_NAME.toString());
}
final MethodInfo methodInfo = MethodInfo.class.cast(target);
final ClassInfo classInfo = methodInfo.declaringClass();
final EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
validateArgumentType(classInfo, methodInfo);
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder(classDescription.getInterceptorClassDescription());
builder.setAroundTimeout(MethodIdentifier.getIdentifier(Object.class, methodInfo.name(), InvocationContext.class));
classDescription.setInterceptorClassDescription(builder.build());
}
use of org.jboss.as.ee.component.EEModuleClassDescription in project wildfly by wildfly.
the class WebServiceAnnotationProcessor method deploy.
@SuppressWarnings({ "unchecked", "rawtypes" })
public final void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
if (index == null || eeModuleDescription == null) {
return;
}
for (final ClassAnnotationInformationFactory factory : factories) {
final Map<String, ClassAnnotationInformation<?, ?>> data = factory.createAnnotationInformation(index, PropertyReplacers.noop());
for (Map.Entry<String, ClassAnnotationInformation<?, ?>> entry : data.entrySet()) {
EEModuleClassDescription clazz = eeModuleDescription.addOrGetLocalClassDescription(entry.getKey());
clazz.addAnnotationInformation(entry.getValue());
}
}
}
use of org.jboss.as.ee.component.EEModuleClassDescription in project wildfly by wildfly.
the class WSIntegrationProcessorJAXWS_EJB method processAnnotation.
@SuppressWarnings("rawtypes")
private static void processAnnotation(final DeploymentUnit unit, final Class annotationType) {
final EEModuleDescription moduleDescription = getRequiredAttachment(unit, EE_MODULE_DESCRIPTION);
final JAXWSDeployment jaxwsDeployment = getJaxwsDeployment(unit);
for (EEModuleClassDescription description : moduleDescription.getClassDescriptions()) {
@SuppressWarnings("unchecked") ClassAnnotationInformation classAnnotationInfo = description.getAnnotationInformation(annotationType);
if (classAnnotationInfo != null && !classAnnotationInfo.getClassLevelAnnotations().isEmpty()) {
Object obj = classAnnotationInfo.getClassLevelAnnotations().get(0);
AnnotationTarget target = null;
if (obj instanceof WebServiceAnnotationInfo) {
target = ((WebServiceAnnotationInfo) obj).getTarget();
} else if (obj instanceof WebServiceProviderAnnotationInfo) {
target = ((WebServiceProviderAnnotationInfo) obj).getTarget();
} else {
return;
}
final ClassInfo webServiceClassInfo = (ClassInfo) target;
final String webServiceClassName = webServiceClassInfo.name().toString();
final List<ComponentDescription> componentDescriptions = moduleDescription.getComponentsByClassName(webServiceClassName);
final List<SessionBeanComponentDescription> sessionBeans = getSessionBeans(componentDescriptions);
// TODO: assembly processed for each endpoint!
final Set<String> securityRoles = getDeclaredSecurityRoles(unit, webServiceClassInfo);
final WebContextAnnotationWrapper webCtx = getWebContextWrapper(webServiceClassInfo);
final String authMethod = webCtx.getAuthMethod();
final boolean isSecureWsdlAccess = webCtx.isSecureWsdlAccess();
final String transportGuarantee = webCtx.getTransportGuarantee();
final String realmName = webCtx.getRealmName();
for (final SessionBeanComponentDescription sessionBean : sessionBeans) {
if (sessionBean.isStateless() || sessionBean.isSingleton()) {
final EJBViewDescription ejbViewDescription = sessionBean.addWebserviceEndpointView();
final ServiceName ejbViewName = ejbViewDescription.getServiceName();
jaxwsDeployment.addEndpoint(new EJBEndpoint(sessionBean, ejbViewName, securityRoles, authMethod, realmName, isSecureWsdlAccess, transportGuarantee));
}
}
}
}
}
use of org.jboss.as.ee.component.EEModuleClassDescription in project wildfly by wildfly.
the class AbstractEEAnnotationProcessor method deploy.
public final void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
PropertyReplacer propertyReplacer = EJBAnnotationPropertyReplacement.propertyReplacer(deploymentUnit);
if (index == null || eeModuleDescription == null) {
return;
}
final List<ClassAnnotationInformationFactory> factories = annotationInformationFactories();
for (final ClassAnnotationInformationFactory factory : factories) {
final Map<String, ClassAnnotationInformation<?, ?>> data = factory.createAnnotationInformation(index, propertyReplacer);
for (Map.Entry<String, ClassAnnotationInformation<?, ?>> entry : data.entrySet()) {
EEModuleClassDescription clazz = eeModuleDescription.addOrGetLocalClassDescription(entry.getKey());
clazz.addAnnotationInformation(entry.getValue());
}
}
afterAnnotationsProcessed(phaseContext, deploymentUnit);
}
use of org.jboss.as.ee.component.EEModuleClassDescription in project wildfly by wildfly.
the class MethodAnnotationAggregator method runtimeAnnotationInformation.
public static <A extends Annotation, T> RuntimeAnnotationInformation<T> runtimeAnnotationInformation(final Class<?> componentClass, final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex index, final Class<A> annotationType) {
final HashSet<MethodIdentifier> methodIdentifiers = new HashSet<MethodIdentifier>();
final Map<Method, List<T>> methods = new HashMap<Method, List<T>>();
final Map<String, List<T>> classAnnotations = new HashMap<String, List<T>>();
Class<?> c = componentClass;
while (c != null && c != Object.class) {
final ClassReflectionIndex classIndex = index.getClassIndex(c);
final EEModuleClassDescription description = applicationClasses.getClassByName(c.getName());
if (description != null) {
ClassAnnotationInformation<A, T> annotationData = description.getAnnotationInformation(annotationType);
if (annotationData != null) {
if (!annotationData.getClassLevelAnnotations().isEmpty()) {
classAnnotations.put(c.getName(), annotationData.getClassLevelAnnotations());
}
for (Map.Entry<MethodIdentifier, List<T>> entry : annotationData.getMethodLevelAnnotations().entrySet()) {
final Method method = classIndex.getMethod(entry.getKey());
if (method != null) {
//we do not have to worry about private methods being overridden
if (Modifier.isPrivate(method.getModifiers()) || !methodIdentifiers.contains(entry.getKey())) {
methods.put(method, entry.getValue());
}
} else {
//but if it does, we give some info
throw EeLogger.ROOT_LOGGER.cannotResolveMethod(entry.getKey(), c, entry.getValue());
}
}
}
}
//so we can check if a method is overriden
for (Method method : (Iterable<Method>) classIndex.getMethods()) {
//we do not have to worry about private methods being overridden
if (!Modifier.isPrivate(method.getModifiers())) {
methodIdentifiers.add(MethodIdentifier.getIdentifierForMethod(method));
}
}
c = c.getSuperclass();
}
return new RuntimeAnnotationInformation<T>(classAnnotations, methods);
}
Aggregations