Search in sources :

Example 1 with BusinessLocalsMetaData

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

the class SessionBeanXmlDescriptorProcessor method processBeanMetaData.

/**
 * Processes the passed {@link org.jboss.metadata.ejb.spec.SessionBeanMetaData} and creates appropriate {@link org.jboss.as.ejb3.component.session.SessionBeanComponentDescription} out of it.
 * The {@link org.jboss.as.ejb3.component.session.SessionBeanComponentDescription} is then added to the {@link org.jboss.as.ee.component.EEModuleDescription module description} available
 * in the deployment unit of the passed {@link DeploymentPhaseContext phaseContext}
 *
 * @param sessionBean  The session bean metadata
 * @param phaseContext
 * @throws DeploymentUnitProcessingException
 */
@Override
protected void processBeanMetaData(final SessionBeanMetaData sessionBean, final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    // get the module description
    final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
    final String beanName = sessionBean.getName();
    ComponentDescription bean = moduleDescription.getComponentByName(beanName);
    if (appclient && bean == null) {
        for (final ComponentDescription component : deploymentUnit.getAttachmentList(Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) {
            if (component.getComponentName().equals(beanName)) {
                bean = component;
                break;
            }
        }
    }
    if (!(bean instanceof SessionBeanComponentDescription)) {
        // if this is a GenericBeanMetadata it may actually represent an MDB
        return;
    }
    SessionBeanComponentDescription sessionBeanDescription = (SessionBeanComponentDescription) bean;
    sessionBeanDescription.setDeploymentDescriptorEnvironment(new DeploymentDescriptorEnvironment("java:comp/env/", sessionBean));
    // mapped-name
    sessionBeanDescription.setMappedName(sessionBean.getMappedName());
    // local business interface views
    final BusinessLocalsMetaData businessLocals = sessionBean.getBusinessLocals();
    if (businessLocals != null && !businessLocals.isEmpty()) {
        sessionBeanDescription.addLocalBusinessInterfaceViews(businessLocals);
    }
    final String local = sessionBean.getLocal();
    if (local != null) {
        sessionBeanDescription.addEjbLocalObjectView(local);
    }
    final String remote = sessionBean.getRemote();
    if (remote != null) {
        sessionBeanDescription.addEjbObjectView(remote);
    }
    // remote business interface views
    final BusinessRemotesMetaData businessRemotes = sessionBean.getBusinessRemotes();
    if (businessRemotes != null && !businessRemotes.isEmpty()) {
        sessionBeanDescription.addRemoteBusinessInterfaceViews(businessRemotes);
    }
    // process Enterprise Beans 3.1 specific session bean description
    if (sessionBean instanceof SessionBean31MetaData) {
        this.processSessionBean31((SessionBean31MetaData) sessionBean, sessionBeanDescription);
    }
}
Also used : ComponentDescription(org.jboss.as.ee.component.ComponentDescription) SessionBeanComponentDescription(org.jboss.as.ejb3.component.session.SessionBeanComponentDescription) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) DeploymentDescriptorEnvironment(org.jboss.as.ee.component.DeploymentDescriptorEnvironment) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) SessionBeanComponentDescription(org.jboss.as.ejb3.component.session.SessionBeanComponentDescription) SessionBean31MetaData(org.jboss.metadata.ejb.spec.SessionBean31MetaData) BusinessLocalsMetaData(org.jboss.metadata.ejb.spec.BusinessLocalsMetaData) BusinessRemotesMetaData(org.jboss.metadata.ejb.spec.BusinessRemotesMetaData)

Aggregations

ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1 DeploymentDescriptorEnvironment (org.jboss.as.ee.component.DeploymentDescriptorEnvironment)1 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)1 SessionBeanComponentDescription (org.jboss.as.ejb3.component.session.SessionBeanComponentDescription)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 BusinessLocalsMetaData (org.jboss.metadata.ejb.spec.BusinessLocalsMetaData)1 BusinessRemotesMetaData (org.jboss.metadata.ejb.spec.BusinessRemotesMetaData)1 SessionBean31MetaData (org.jboss.metadata.ejb.spec.SessionBean31MetaData)1