Search in sources :

Example 1 with EnterpriseBeansMetaData

use of org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData in project wildfly by wildfly.

the class AbstractEjbXmlDescriptorProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    // get the deployment unit
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    // find the EJB jar metadata and start processing it
    EjbJarMetaData ejbJarMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
    if (ejbJarMetaData == null) {
        return;
    }
    // process EJBs
    EnterpriseBeansMetaData ejbs = ejbJarMetaData.getEnterpriseBeans();
    if (ejbs != null && !ejbs.isEmpty()) {
        for (EnterpriseBeanMetaData ejb : ejbs) {
            if (this.getMetaDataType().isInstance(ejb)) {
                this.processBeanMetaData((T) ejb, phaseContext);
            }
        }
    }
}
Also used : EnterpriseBeansMetaData(org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData) EjbJarMetaData(org.jboss.metadata.ejb.spec.EjbJarMetaData) EnterpriseBeanMetaData(org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 2 with EnterpriseBeansMetaData

use of org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData 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)

Aggregations

EjbJarMetaData (org.jboss.metadata.ejb.spec.EjbJarMetaData)2 EnterpriseBeanMetaData (org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData)2 EnterpriseBeansMetaData (org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData)2 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1 EjbJarDescription (org.jboss.as.ejb3.deployment.EjbJarDescription)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1