Search in sources :

Example 1 with EEApplicationDescription

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

the class EjbDependsOnMergingProcessor method handleDeploymentDescriptor.

@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription description) throws DeploymentUnitProcessingException {
    final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_DESCRIPTION);
    final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
    if (description.getDescriptorData() instanceof SessionBean31MetaData) {
        SessionBean31MetaData metaData = (SessionBean31MetaData) description.getDescriptorData();
        if (metaData.getDependsOn() != null) {
            setupDependencies(description, applicationDescription, deploymentRoot, metaData.getDependsOn());
        }
    }
}
Also used : EEApplicationDescription(org.jboss.as.ee.component.EEApplicationDescription) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) SessionBean31MetaData(org.jboss.metadata.ejb.spec.SessionBean31MetaData)

Example 2 with EEApplicationDescription

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

the class ComponentAggregationProcessor method deploy.

public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ComponentRegistry componentRegistry = new ComponentRegistry(phaseContext.getServiceRegistry());
    final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(EE_MODULE_DESCRIPTION);
    if (moduleDescription == null) {
        return;
    }
    phaseContext.getServiceTarget().addService(ComponentRegistry.serviceName(deploymentUnit), new ValueService<>(new ImmediateValue<Object>(componentRegistry))).addDependency(moduleDescription.getDefaultClassIntrospectorServiceName(), EEClassIntrospector.class, componentRegistry.getClassIntrospectorInjectedValue()).install();
    deploymentUnit.putAttachment(COMPONENT_REGISTRY, componentRegistry);
    if (deploymentUnit.getAttachment(Attachments.DEPLOYMENT_TYPE) == DeploymentType.EAR) {
        final EEApplicationDescription applicationDescription = new EEApplicationDescription();
        deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription);
        for (final Map.Entry<String, String> messageDestination : moduleDescription.getMessageDestinations().entrySet()) {
            applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT).getRoot());
        }
        /*
            * We are an EAR, so we must inspect all of our subdeployments and aggregate all their component views
            * into a single index, so that inter-module resolution will work.
            */
        // Add the application description
        final List<DeploymentUnit> subdeployments = deploymentUnit.getAttachmentList(SUB_DEPLOYMENTS);
        for (final DeploymentUnit subdeployment : subdeployments) {
            final EEModuleDescription subDeploymentModuleDescription = subdeployment.getAttachment(EE_MODULE_DESCRIPTION);
            final ResourceRoot deploymentRoot = subdeployment.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
            if (subDeploymentModuleDescription == null) {
                // Not an EE deployment.
                continue;
            }
            for (final ComponentDescription componentDescription : subDeploymentModuleDescription.getComponentDescriptions()) {
                applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
            }
            for (final Map.Entry<String, String> messageDestination : subDeploymentModuleDescription.getMessageDestinations().entrySet()) {
                applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot());
            }
            for (final ComponentDescription componentDescription : subdeployment.getAttachmentList(org.jboss.as.ee.component.Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) {
                applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
            }
            subdeployment.putAttachment(EE_APPLICATION_DESCRIPTION, applicationDescription);
        }
    } else if (deploymentUnit.getParent() == null) {
        final EEApplicationDescription applicationDescription = new EEApplicationDescription();
        deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription);
        /*
             * We are a top-level EE deployment, or a non-EE deployment.  Our "aggregate" index is just a copy of
             * our local EE module index.
             */
        final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
        for (final ComponentDescription componentDescription : moduleDescription.getComponentDescriptions()) {
            applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
        }
        for (final Map.Entry<String, String> messageDestination : moduleDescription.getMessageDestinations().entrySet()) {
            applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot());
        }
        for (final ComponentDescription componentDescription : deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) {
            applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
        }
    }
}
Also used : EEApplicationDescription(org.jboss.as.ee.component.EEApplicationDescription) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) ImmediateValue(org.jboss.msc.value.ImmediateValue) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) ComponentRegistry(org.jboss.as.ee.component.ComponentRegistry) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) Map(java.util.Map) EEClassIntrospector(org.jboss.as.ee.component.EEClassIntrospector)

Example 3 with EEApplicationDescription

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

the class EjbInjectionSource method getViews.

private Set<ViewDescription> getViews() {
    final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION);
    final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
    final Set<ViewDescription> componentsForViewName;
    if (beanName != null) {
        componentsForViewName = applicationDescription.getComponents(beanName, typeName, deploymentRoot.getRoot());
    } else {
        componentsForViewName = applicationDescription.getComponentsForViewName(typeName, deploymentRoot.getRoot());
    }
    return componentsForViewName;
}
Also used : EEApplicationDescription(org.jboss.as.ee.component.EEApplicationDescription) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) EJBViewDescription(org.jboss.as.ejb3.component.EJBViewDescription) ViewDescription(org.jboss.as.ee.component.ViewDescription)

Example 4 with EEApplicationDescription

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

the class MessageDestinationInjectionSource method resolve.

public void resolve(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION);
    final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
    final Set<String> names = applicationDescription.resolveMessageDestination(messageDestinationName, deploymentRoot.getRoot());
    if (names.isEmpty()) {
        error = EeLogger.ROOT_LOGGER.noMessageDestination(messageDestinationName, bindingName);
        return;
    }
    if (names.size() > 1) {
        error = EeLogger.ROOT_LOGGER.moreThanOneMessageDestination(messageDestinationName, bindingName, names);
        return;
    }
    resolvedLookupName = names.iterator().next();
}
Also used : EEApplicationDescription(org.jboss.as.ee.component.EEApplicationDescription) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 5 with EEApplicationDescription

use of org.jboss.as.ee.component.EEApplicationDescription 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)

Aggregations

EEApplicationDescription (org.jboss.as.ee.component.EEApplicationDescription)5 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)5 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)2 Map (java.util.Map)1 DependsOn (javax.ejb.DependsOn)1 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1 ComponentRegistry (org.jboss.as.ee.component.ComponentRegistry)1 EEClassIntrospector (org.jboss.as.ee.component.EEClassIntrospector)1 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)1 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)1 ViewDescription (org.jboss.as.ee.component.ViewDescription)1 EJBViewDescription (org.jboss.as.ejb3.component.EJBViewDescription)1 SessionBean31MetaData (org.jboss.metadata.ejb.spec.SessionBean31MetaData)1 ImmediateValue (org.jboss.msc.value.ImmediateValue)1