Search in sources :

Example 16 with ComponentDescription

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

the class EjbManagementDeploymentUnitProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final EEModuleConfiguration moduleDescription = deploymentUnit.getAttachment(EE_MODULE_CONFIGURATION);
    if (moduleDescription == null) {
        // Nothing to do
        return;
    }
    if (deploymentUnit.getParent() != null && deploymentUnit.getParent().getParent() != null) {
        // We only expose management resources 2 levels deep
        return;
    }
    // Iterate through each component, installing it into the container
    for (final ComponentConfiguration configuration : moduleDescription.getComponentConfigurations()) {
        try {
            final ComponentDescription componentDescription = configuration.getComponentDescription();
            if (componentDescription instanceof EJBComponentDescription) {
                installManagementResource(configuration, deploymentUnit);
            }
        } catch (RuntimeException e) {
            throw EjbLogger.ROOT_LOGGER.failedToInstallManagementResource(e, configuration.getComponentName());
        }
    }
}
Also used : ComponentConfiguration(org.jboss.as.ee.component.ComponentConfiguration) EJBComponentDescription(org.jboss.as.ejb3.component.EJBComponentDescription) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) EEModuleConfiguration(org.jboss.as.ee.component.EEModuleConfiguration) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) EJBComponentDescription(org.jboss.as.ejb3.component.EJBComponentDescription)

Example 17 with ComponentDescription

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

the class AbstractDeploymentUnitProcessor method processDeploymentDescriptor.

protected void processDeploymentDescriptor(final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
    // find the EJB jar metadata and start processing it
    final EjbJarMetaData ejbJarMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
    if (ejbJarMetaData == null) {
        return;
    }
    final SimpleSet<String> annotatedEJBs;
    if (appclient) {
        final List<ComponentDescription> additionalComponents = deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS);
        annotatedEJBs = new SimpleSet<String>() {

            @Override
            public boolean contains(Object o) {
                for (final ComponentDescription component : additionalComponents) {
                    if (component.getComponentName().equals(o)) {
                        return true;
                    }
                }
                return false;
            }
        };
    } else {
        final EjbJarDescription ejbJarDescription = getEjbJarDescription(deploymentUnit);
        annotatedEJBs = new SimpleSet<String>() {

            @Override
            public boolean contains(Object o) {
                return ejbJarDescription.hasComponent((String) o);
            }
        };
    }
    // process EJBs
    final EnterpriseBeansMetaData ejbs = ejbJarMetaData.getEnterpriseBeans();
    if (ejbs != null && !ejbs.isEmpty()) {
        for (final EnterpriseBeanMetaData ejb : ejbs) {
            final String beanName = ejb.getName();
            // the important bit is to skip already processed EJBs via annotations
            if (annotatedEJBs.contains(beanName)) {
                continue;
            }
            processBeanMetaData(deploymentUnit, ejb);
        }
    }
    EjbDeploymentMarker.mark(deploymentUnit);
}
Also used : ComponentDescription(org.jboss.as.ee.component.ComponentDescription) EnterpriseBeansMetaData(org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData) EjbJarMetaData(org.jboss.metadata.ejb.spec.EjbJarMetaData) EjbJarDescription(org.jboss.as.ejb3.deployment.EjbJarDescription) EnterpriseBeanMetaData(org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData)

Example 18 with ComponentDescription

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

the class BusinessViewAnnotationProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) {
        return;
    }
    final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(EE_MODULE_DESCRIPTION);
    final Collection<ComponentDescription> componentDescriptions = eeModuleDescription.getComponentDescriptions();
    final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
    if (module == null) {
        return;
    }
    final ClassLoader moduleClassLoader = module.getClassLoader();
    if (componentDescriptions != null) {
        for (ComponentDescription componentDescription : componentDescriptions) {
            if (componentDescription instanceof SessionBeanComponentDescription == false) {
                continue;
            }
            final Class<?> ejbClass = this.getEjbClass(componentDescription.getComponentClassName(), moduleClassLoader);
            try {
                this.processViewAnnotations(deploymentUnit, ejbClass, (SessionBeanComponentDescription) componentDescription);
            } catch (Exception e) {
                throw EjbLogger.ROOT_LOGGER.failedToProcessBusinessInterfaces(ejbClass, e);
            }
        }
    }
    if (appclient) {
        for (ComponentDescription componentDescription : deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) {
            if (componentDescription instanceof SessionBeanComponentDescription == false) {
                continue;
            }
            final Class<?> ejbClass = this.getEjbClass(componentDescription.getComponentClassName(), moduleClassLoader);
            try {
                this.processViewAnnotations(deploymentUnit, ejbClass, (SessionBeanComponentDescription) componentDescription);
            } catch (Exception e) {
                throw EjbLogger.ROOT_LOGGER.failedToProcessBusinessInterfaces(ejbClass, e);
            }
        }
    }
}
Also used : SessionBeanComponentDescription(org.jboss.as.ejb3.component.session.SessionBeanComponentDescription) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) Module(org.jboss.modules.Module) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) SessionBeanComponentDescription(org.jboss.as.ejb3.component.session.SessionBeanComponentDescription) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException)

Example 19 with ComponentDescription

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

the class AbstractMergingProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
    final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
    final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions();
    final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
    final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
    if (componentConfigurations == null || componentConfigurations.isEmpty()) {
        return;
    }
    for (ComponentDescription componentConfiguration : componentConfigurations) {
        if (typeParam.isAssignableFrom(componentConfiguration.getClass())) {
            try {
                processComponentConfig(deploymentUnit, applicationClasses, module, deploymentReflectionIndex, (T) componentConfiguration);
            } catch (Exception e) {
                throw EjbLogger.ROOT_LOGGER.failToMergeData(componentConfiguration.getComponentName(), e);
            }
        }
    }
}
Also used : EJBComponentDescription(org.jboss.as.ejb3.component.EJBComponentDescription) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) EEApplicationClasses(org.jboss.as.ee.component.EEApplicationClasses) Module(org.jboss.modules.Module) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) DeploymentReflectionIndex(org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException)

Example 20 with ComponentDescription

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

the class BeanValidationFactoryDeployer method bindFactoryToJndi.

private void bindFactoryToJndi(LazyValidatorFactory factory, DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext, EEModuleDescription moduleDescription) {
    if (moduleDescription == null) {
        return;
    }
    final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
    //if this is a war we need to bind to the modules comp namespace
    if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit) || DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) {
        final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(), moduleDescription.getModuleName());
        bindServices(factory, serviceTarget, moduleDescription, moduleDescription.getModuleName(), moduleContextServiceName);
    }
    for (ComponentDescription component : moduleDescription.getComponentDescriptions()) {
        if (component.getNamingMode() == ComponentNamingMode.CREATE) {
            final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(), moduleDescription.getModuleName(), component.getComponentName());
            bindServices(factory, serviceTarget, moduleDescription, component.getComponentName(), compContextServiceName);
        }
    }
}
Also used : ComponentDescription(org.jboss.as.ee.component.ComponentDescription) ServiceName(org.jboss.msc.service.ServiceName) ServiceTarget(org.jboss.msc.service.ServiceTarget)

Aggregations

ComponentDescription (org.jboss.as.ee.component.ComponentDescription)65 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)45 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)44 ServiceName (org.jboss.msc.service.ServiceName)20 ComponentConfiguration (org.jboss.as.ee.component.ComponentConfiguration)19 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)18 Module (org.jboss.modules.Module)18 EJBComponentDescription (org.jboss.as.ejb3.component.EJBComponentDescription)17 ComponentConfigurator (org.jboss.as.ee.component.ComponentConfigurator)16 DeploymentPhaseContext (org.jboss.as.server.deployment.DeploymentPhaseContext)16 SessionBeanComponentDescription (org.jboss.as.ejb3.component.session.SessionBeanComponentDescription)15 DeploymentReflectionIndex (org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex)11 HashMap (java.util.HashMap)10 HashSet (java.util.HashSet)9 EEApplicationClasses (org.jboss.as.ee.component.EEApplicationClasses)9 ServiceTarget (org.jboss.msc.service.ServiceTarget)9 ImmediateInterceptorFactory (org.jboss.invocation.ImmediateInterceptorFactory)8 BindingConfiguration (org.jboss.as.ee.component.BindingConfiguration)5 DependencyConfigurator (org.jboss.as.ee.component.DependencyConfigurator)5 InterceptorDescription (org.jboss.as.ee.component.InterceptorDescription)5