Search in sources :

Example 1 with IIOPMetaData

use of org.jboss.metadata.ejb.jboss.IIOPMetaData in project wildfly by wildfly.

the class EjbIIOPDeploymentUnitProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (!IIOPDeploymentMarker.isIIOPDeployment(deploymentUnit)) {
        return;
    }
    final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
    if (!EjbDeploymentMarker.isEjbDeployment(deploymentUnit)) {
        return;
    }
    // a bean-name -> IIOPMetaData map, reflecting the assembly descriptor IIOP configuration.
    Map<String, IIOPMetaData> iiopMetaDataMap = new HashMap<String, IIOPMetaData>();
    final EjbJarMetaData ejbMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
    if (ejbMetaData != null && ejbMetaData.getAssemblyDescriptor() != null) {
        List<IIOPMetaData> iiopMetaDatas = ejbMetaData.getAssemblyDescriptor().getAny(IIOPMetaData.class);
        if (iiopMetaDatas != null && iiopMetaDatas.size() > 0) {
            for (IIOPMetaData metaData : iiopMetaDatas) {
                iiopMetaDataMap.put(metaData.getEjbName(), metaData);
            }
        }
    }
    final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
    final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
    if (moduleDescription != null) {
        for (final ComponentDescription componentDescription : moduleDescription.getComponentDescriptions()) {
            if (componentDescription instanceof EJBComponentDescription) {
                final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) componentDescription;
                if (ejbComponentDescription.getEjbRemoteView() != null && ejbComponentDescription.getEjbHomeView() != null) {
                    // check if there is IIOP metadata for the bean - first using the bean name, then the wildcard "*" if needed.
                    IIOPMetaData iiopMetaData = iiopMetaDataMap.get(ejbComponentDescription.getEJBName());
                    if (iiopMetaData == null) {
                        iiopMetaData = iiopMetaDataMap.get(IIOPMetaData.WILDCARD_BEAN_NAME);
                    }
                    // has been enabled by default in the EJB3 subsystem.
                    if (iiopMetaData != null || settingsService.isEnabledByDefault()) {
                        processEjb(ejbComponentDescription, deploymentReflectionIndex, module, phaseContext.getServiceTarget(), iiopMetaData);
                    }
                }
            }
        }
    }
}
Also used : EJBComponentDescription(org.jboss.as.ejb3.component.EJBComponentDescription) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) HashMap(java.util.HashMap) IIOPMetaData(org.jboss.metadata.ejb.jboss.IIOPMetaData) EjbJarMetaData(org.jboss.metadata.ejb.spec.EjbJarMetaData) Module(org.jboss.modules.Module) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) DeploymentReflectionIndex(org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex) EJBComponentDescription(org.jboss.as.ejb3.component.EJBComponentDescription)

Aggregations

HashMap (java.util.HashMap)1 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)1 EJBComponentDescription (org.jboss.as.ejb3.component.EJBComponentDescription)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 DeploymentReflectionIndex (org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex)1 IIOPMetaData (org.jboss.metadata.ejb.jboss.IIOPMetaData)1 EjbJarMetaData (org.jboss.metadata.ejb.spec.EjbJarMetaData)1 Module (org.jboss.modules.Module)1