Search in sources :

Example 21 with EEModuleClassDescription

use of org.jboss.as.ee.component.EEModuleClassDescription in project wildfly by wildfly.

the class AroundInvokeAnnotationParsingProcessor method processAroundInvoke.

private void processAroundInvoke(final EEModuleDescription eeModuleDescription, final AnnotationTarget target) throws DeploymentUnitProcessingException {
    if (!(target instanceof MethodInfo)) {
        throw EeLogger.ROOT_LOGGER.methodOnlyAnnotation(AROUND_INVOKE_ANNOTATION_NAME);
    }
    final MethodInfo methodInfo = MethodInfo.class.cast(target);
    final ClassInfo classInfo = methodInfo.declaringClass();
    final EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
    final List<AnnotationInstance> classAroundInvokes = classInfo.annotations().get(AROUND_INVOKE_ANNOTATION_NAME);
    if (classAroundInvokes.size() > 1) {
        throw EeLogger.ROOT_LOGGER.aroundInvokeAnnotationUsedTooManyTimes(classInfo.name(), classAroundInvokes.size());
    }
    validateArgumentType(classInfo, methodInfo);
    InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder(classDescription.getInterceptorClassDescription());
    builder.setAroundInvoke(MethodIdentifier.getIdentifier(Object.class, methodInfo.name(), InvocationContext.class));
    classDescription.setInterceptorClassDescription(builder.build());
}
Also used : InterceptorClassDescription(org.jboss.as.ee.component.interceptors.InterceptorClassDescription) MethodInfo(org.jboss.jandex.MethodInfo) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription) InvocationContext(javax.interceptor.InvocationContext) AnnotationInstance(org.jboss.jandex.AnnotationInstance) ClassInfo(org.jboss.jandex.ClassInfo)

Example 22 with EEModuleClassDescription

use of org.jboss.as.ee.component.EEModuleClassDescription in project wildfly by wildfly.

the class AbstractPoolMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(DeploymentUnit deploymentUnit, EEApplicationClasses applicationClasses, DeploymentReflectionIndex deploymentReflectionIndex, Class<?> componentClass, T description) throws DeploymentUnitProcessingException {
    final EEModuleClassDescription clazz = applicationClasses.getClassByName(componentClass.getName());
    //we only care about annotations on the bean class itself
    if (clazz == null) {
        return;
    }
    final ClassAnnotationInformation<Pool, String> pool = clazz.getAnnotationInformation(Pool.class);
    if (pool == null) {
        return;
    }
    if (!pool.getClassLevelAnnotations().isEmpty()) {
        final String poolName = pool.getClassLevelAnnotations().get(0);
        if (poolName == null || poolName.trim().isEmpty()) {
            throw EjbLogger.ROOT_LOGGER.poolNameCannotBeEmptyString(description.getEJBName());
        }
        this.setPoolName(description, poolName);
    }
}
Also used : Pool(org.jboss.ejb3.annotation.Pool) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription)

Example 23 with EEModuleClassDescription

use of org.jboss.as.ee.component.EEModuleClassDescription in project wildfly by wildfly.

the class CacheMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(DeploymentUnit deploymentUnit, EEApplicationClasses applicationClasses, DeploymentReflectionIndex deploymentReflectionIndex, Class<?> componentClass, StatefulComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
    final EEModuleClassDescription clazz = applicationClasses.getClassByName(componentClass.getName());
    //we only care about annotations on the bean class itself
    if (clazz == null) {
        return;
    }
    final ClassAnnotationInformation<Cache, CacheInfo> cache = clazz.getAnnotationInformation(Cache.class);
    if (cache == null) {
        return;
    }
    if (!cache.getClassLevelAnnotations().isEmpty()) {
        componentConfiguration.setCache(cache.getClassLevelAnnotations().get(0));
    }
}
Also used : EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription) CacheInfo(org.jboss.as.ejb3.cache.CacheInfo) Cache(org.jboss.ejb3.annotation.Cache)

Example 24 with EEModuleClassDescription

use of org.jboss.as.ee.component.EEModuleClassDescription in project wildfly by wildfly.

the class ClusteredSingletonMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(DeploymentUnit deploymentUnit, EEApplicationClasses applicationClasses, DeploymentReflectionIndex deploymentReflectionIndex, Class<?> componentClass, MessageDrivenComponentDescription componentDescription) throws DeploymentUnitProcessingException {
    final EEModuleClassDescription clazz = applicationClasses.getClassByName(componentClass.getName());
    //we only care about annotations on the bean class itself
    if (clazz == null) {
        return;
    }
    final ClassAnnotationInformation<ClusteredSingleton, Boolean> clustering = clazz.getAnnotationInformation(ClusteredSingleton.class);
    if (clustering == null || clustering.getClassLevelAnnotations().isEmpty()) {
        return;
    }
    componentDescription.setClusteredSingleton(true);
}
Also used : ClusteredSingleton(org.jboss.ejb3.annotation.ClusteredSingleton) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription)

Example 25 with EEModuleClassDescription

use of org.jboss.as.ee.component.EEModuleClassDescription in project wildfly by wildfly.

the class ResourceAdaptorMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final MessageDrivenComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
    final EEModuleClassDescription clazz = applicationClasses.getClassByName(componentClass.getName());
    //we only care about annotations on the bean class itself
    if (clazz == null) {
        return;
    }
    final ClassAnnotationInformation<ResourceAdapter, String> resourceAdapter = clazz.getAnnotationInformation(ResourceAdapter.class);
    if (resourceAdapter == null || resourceAdapter.getClassLevelAnnotations().isEmpty()) {
        return;
    }
    final String configuredAdapterName = resourceAdapter.getClassLevelAnnotations().get(0);
    final String adapterName = addEarPrefixIfRelativeName(configuredAdapterName, deploymentUnit, componentClass);
    componentConfiguration.setResourceAdapterName(adapterName);
}
Also used : ResourceAdapter(org.jboss.ejb3.annotation.ResourceAdapter) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription)

Aggregations

EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)29 ClassInfo (org.jboss.jandex.ClassInfo)9 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)6 MethodInfo (org.jboss.jandex.MethodInfo)6 CompositeIndex (org.jboss.as.server.deployment.annotation.CompositeIndex)5 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)4 InterceptorClassDescription (org.jboss.as.ee.component.interceptors.InterceptorClassDescription)4 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)4 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 InvocationContext (javax.interceptor.InvocationContext)3 BindingConfiguration (org.jboss.as.ee.component.BindingConfiguration)3 InjectionSource (org.jboss.as.ee.component.InjectionSource)3 EJBEndpoint (org.jboss.as.webservices.metadata.model.EJBEndpoint)3 AnnotationInstance (org.jboss.jandex.AnnotationInstance)3 AnnotationTarget (org.jboss.jandex.AnnotationTarget)3 ServiceName (org.jboss.msc.service.ServiceName)3 WebService (javax.jws.WebService)2 WebServiceProvider (javax.xml.ws.WebServiceProvider)2