Search in sources :

Example 26 with EEModuleClassDescription

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

the class SecurityDomainMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription 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<SecurityDomain, String> securityDomain = clazz.getAnnotationInformation(SecurityDomain.class);
    if (securityDomain == null) {
        return;
    }
    if (!securityDomain.getClassLevelAnnotations().isEmpty()) {
        if (ROOT_LOGGER.isDebugEnabled()) {
            ROOT_LOGGER.debug("EJB " + description.getEJBName() + " is part of security domain " + securityDomain.getClassLevelAnnotations().get(0));
        }
        description.setSecurityDomain(securityDomain.getClassLevelAnnotations().get(0));
    }
}
Also used : EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription) SecurityDomain(org.jboss.ejb3.annotation.SecurityDomain)

Example 27 with EEModuleClassDescription

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

the class DeclareRolesMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription 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<DeclareRoles, String[]> declareRoles = clazz.getAnnotationInformation(DeclareRoles.class);
    if (declareRoles == null) {
        return;
    }
    if (!declareRoles.getClassLevelAnnotations().isEmpty()) {
        description.addDeclaredRoles(declareRoles.getClassLevelAnnotations().get(0));
    }
}
Also used : DeclareRoles(javax.annotation.security.DeclareRoles) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription)

Example 28 with EEModuleClassDescription

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

the class EjbDependsOnMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription description) throws DeploymentUnitProcessingException {
    final EEModuleClassDescription classDescription = applicationClasses.getClassByName(componentClass.getName());
    if (classDescription == null) {
        return;
    }
    final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_DESCRIPTION);
    final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
    //we ony care about annotations on the actual class
    final ClassAnnotationInformation<DependsOn, String[]> dependsOnClassAnnotationInformation = classDescription.getAnnotationInformation(DependsOn.class);
    if (dependsOnClassAnnotationInformation != null) {
        if (!dependsOnClassAnnotationInformation.getClassLevelAnnotations().isEmpty()) {
            final String[] annotationValues = dependsOnClassAnnotationInformation.getClassLevelAnnotations().get(0);
            setupDependencies(description, applicationDescription, deploymentRoot, annotationValues);
        }
    }
}
Also used : EEApplicationDescription(org.jboss.as.ee.component.EEApplicationDescription) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) DependsOn(javax.ejb.DependsOn) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription)

Example 29 with EEModuleClassDescription

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

the class HomeViewMergingProcessor method processComponentConfig.

private void processComponentConfig(final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final Module module, final DeploymentReflectionIndex deploymentReflectionIndex, final SessionBeanComponentDescription description) throws DeploymentUnitProcessingException, ClassNotFoundException {
    String home = null;
    String localHome = null;
    //first check for annotations
    if (!MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) {
        final EEModuleClassDescription clazz = applicationClasses.getClassByName(description.getComponentClassName());
        //we only care about annotations on the bean class itself
        if (clazz != null) {
            final ClassAnnotationInformation<LocalHome, String> localAnnotations = clazz.getAnnotationInformation(LocalHome.class);
            if (localAnnotations != null) {
                if (!localAnnotations.getClassLevelAnnotations().isEmpty()) {
                    localHome = localAnnotations.getClassLevelAnnotations().get(0);
                    if (description.getEjbLocalView() == null) {
                        //If the local home is specified via annotation then the corresponding business interface is implied
                        //by the signature of the create method
                        //See EJB 3.1 21.4.5
                        final String localClassName = this.inferLocalInterfaceFromLocalHome(localHome, module, deploymentReflectionIndex, description);
                        description.addEjbLocalObjectView(localClassName);
                    }
                }
            }
            final ClassAnnotationInformation<RemoteHome, String> remoteAnnotations = clazz.getAnnotationInformation(RemoteHome.class);
            if (remoteAnnotations != null) {
                if (!remoteAnnotations.getClassLevelAnnotations().isEmpty()) {
                    home = remoteAnnotations.getClassLevelAnnotations().get(0);
                    if (description.getEjbRemoteView() == null) {
                        //If the remote home is specified via annotation then the corresponding business interface is implied
                        //by the signature of the create method
                        //See EJB 3.1 21.4.5
                        final String remoteClassName = this.inferRemoteInterfaceFromHome(home, module, deploymentReflectionIndex, description);
                        description.addEjbObjectView(remoteClassName);
                    }
                }
            }
        }
    }
    //now allow the annotations to be overridden by the DD
    final SessionBeanMetaData descriptorData = description.getDescriptorData();
    if (descriptorData != null) {
        if (descriptorData.getHome() != null) {
            home = descriptorData.getHome();
        }
        if (descriptorData.getLocalHome() != null) {
            localHome = descriptorData.getLocalHome();
        }
    }
    if (localHome != null) {
        description.addLocalHome(localHome);
    }
    if (home != null) {
        description.addRemoteHome(home);
    }
    // finally see if we have to infer the remote or local interface from the home/local home views, respectively
    if (description.getEjbHomeView() != null && description.getEjbRemoteView() == null) {
        final String remoteClassName = this.inferRemoteInterfaceFromHome(description.getEjbHomeView().getViewClassName(), module, deploymentReflectionIndex, description);
        description.addEjbObjectView(remoteClassName);
    }
    if (description.getEjbLocalHomeView() != null && description.getEjbLocalView() == null) {
        final String localClassName = this.inferLocalInterfaceFromLocalHome(description.getEjbLocalHomeView().getViewClassName(), module, deploymentReflectionIndex, description);
        description.addEjbLocalObjectView(localClassName);
    }
}
Also used : SessionBeanMetaData(org.jboss.metadata.ejb.spec.SessionBeanMetaData) RemoteHome(javax.ejb.RemoteHome) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription) LocalHome(javax.ejb.LocalHome)

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