Examples of SessionBeanComponentDescription


Examples of org.jboss.as.ejb3.component.session.SessionBeanComponentDescription

    protected void processComponentConfig(DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext, CompositeIndex index, ComponentDescription componentDescription) throws DeploymentUnitProcessingException {

        if (!(componentDescription instanceof SessionBeanComponentDescription)) {
            return;
        }
        SessionBeanComponentDescription sessionBeanComponentDescription = (SessionBeanComponentDescription) componentDescription;
        // if it already has a no-interface  view, then no need to check for the implicit rules
        if (sessionBeanComponentDescription.hasNoInterfaceView()) {
            return;
        }
        // if the bean already exposes some view(s) then it isn't eligible for an implicit no-interface view.
        if (!sessionBeanComponentDescription.getViews().isEmpty()) {
            return;
        }
        String ejbClassName = sessionBeanComponentDescription.getComponentClassName();

        final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
        if (module == null) {
            throw EjbLogger.EJB3_LOGGER.moduleNotAttachedToDeploymentUnit(deploymentUnit);
        }
        ClassLoader cl = module.getClassLoader();
        Class<?> ejbClass = null;
        try {
            ejbClass = cl.loadClass(ejbClassName);
        } catch (ClassNotFoundException cnfe) {
            throw new DeploymentUnitProcessingException(cnfe);
        }
        // check whether it's eligible for implicit no-interface view
        if (this.exposesNoInterfaceView(ejbClass)) {
            logger.debug("Bean: " + sessionBeanComponentDescription.getEJBName() + " will be marked for (implicit) no-interface view");
            sessionBeanComponentDescription.addNoInterfaceView();
            return;
        }

        // check for default local view
        Class<?> defaultLocalView = this.getDefaultLocalView(ejbClass);
        if (defaultLocalView != null) {
            logger.debug("Bean: " + sessionBeanComponentDescription.getEJBName() + " will be marked for default local view: " + defaultLocalView.getName());
            sessionBeanComponentDescription.addLocalBusinessInterfaceViews(Collections.singleton(defaultLocalView.getName()));
            return;
        }


    }
View Full Code Here

Examples of org.jboss.as.ejb3.component.session.SessionBeanComponentDescription

            } else {
                beanClassName = sessionBeanClassInfo.name().toString();
                sessionBeanType = annotatedSessionBeanType;
            }

            final SessionBeanComponentDescription sessionBeanDescription;
            switch (sessionBeanType) {
                case STATELESS:
                    sessionBeanDescription = new StatelessComponentDescription(beanName, beanClassName, ejbJarDescription, deploymentUnitServiceName, beanMetaData);
                    break;
                case STATEFUL:
View Full Code Here

Examples of org.jboss.as.ejb3.component.session.SessionBeanComponentDescription

                throw EjbMessages.MESSAGES.sessionTypeNotSpecified(beanName);
            }
        }

        final String beanClassName = sessionBean.getEjbClass();
        final SessionBeanComponentDescription sessionBeanDescription;
        switch (sessionType) {
            case Stateless:
                sessionBeanDescription = new StatelessComponentDescription(beanName, beanClassName, ejbJarDescription, deploymentUnit.getServiceName(), sessionBean);
                break;
            case Stateful:
View Full Code Here

Examples of org.jboss.as.ejb3.component.session.SessionBeanComponentDescription

        /*
        * Special handling of stateful session bean getEJBObject due how the stateful session handles acquire the
        * proxy by sending an invocation to the ejb container.
        */
        if (component instanceof SessionBeanComponentDescription) {
            SessionBeanComponentDescription session = SessionBeanComponentDescription.class.cast(component);
            if (session.isStateful()) {
                EJBMethodPermission p = new EJBMethodPermission(ejbName, "getEJBObject", "Home", null);
                config.addPermit(p);
            }
        }
    }
View Full Code Here

Examples of org.jboss.as.ejb3.component.session.SessionBeanComponentDescription

        final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
        for (ComponentDescription component : moduleDescription.getComponentDescriptions()) {
            BeanDeploymentArchiveImpl bda = resolveComponentBda(component.getComponentClassName(), bdaMap, rootBda, indexes);
            component.setBeanDeploymentArchiveId(bda.getId());
            if (component instanceof SessionBeanComponentDescription) {
                SessionBeanComponentDescription componentDescription = (SessionBeanComponentDescription) component;
                //first we need to resolve the correct BDA for the bean
                bda.addEjbDescriptor(new EjbDescriptorImpl<Object>(componentDescription, bda, reflectionIndex));
            }
        }
    }
View Full Code Here

Examples of org.jboss.as.ejb3.component.session.SessionBeanComponentDescription

    private void processEjbComponents(DeploymentUnit deploymentUnit, Map<ResourceRoot, BeanDeploymentArchiveImpl> bdaMap, BeanDeploymentArchiveImpl rootBda, Map<ResourceRoot, Index> indexes) {
        final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
        for(AbstractComponentDescription component : moduleDescription.getComponentDescriptions()) {
            if(component instanceof SessionBeanComponentDescription) {
                SessionBeanComponentDescription componentDescription = (SessionBeanComponentDescription) component;
                //first we need to resolve the correct BDA for the bean
                BeanDeploymentArchiveImpl bda = resolveSessionBeanBda(componentDescription.getEJBClassName(), bdaMap,rootBda,indexes);
                bda.addEjbDescriptor(new EjbDescriptorImpl<Object>(componentDescription,bda,deploymentUnit));
            }
        }
    }
View Full Code Here

Examples of org.jboss.as.ejb3.component.session.SessionBeanComponentDescription

            } else {
                // both original and override session beans are non-empty. Merge them
                Set<String> commonBeans = new HashSet<String>();
                for (SessionBeanComponentDescription originalSessionBean : original) {
                    // find the session bean in the overriden collection
                    SessionBeanComponentDescription overrideSessionBean = findSessionBean(originalSessionBean.getEJBName(), override);
                    if (overrideSessionBean == null) {
                        // if there's no overridden session bean, then just add the original to the merged collection
                        mergedResult.add(originalSessionBean);
                    } else {
                        // make sure we are merging beans of the same type
                        SessionBeanComponentDescription.SessionBeanType sessionBeanType = originalSessionBean.getSessionBeanType();
                        if (overrideSessionBean.getSessionBeanType() != sessionBeanType) {
                            throw new RuntimeException("Cannot mergeSessionBean two EJBs with the same name = " + originalSessionBean.getEJBName() +
                                    " but with different session bean types, type 1 - " + overrideSessionBean.getSessionBeanType()
                                    + " type 2 - " + originalSessionBean.getSessionBeanType());
                        }
                        // there's a overridden session bean, so merge them
                        commonBeans.add(originalSessionBean.getEJBName());
                        SessionBeanComponentDescription mergedBean = createNewSessionBean(originalSessionBean, ejbModuleDescription);
                        switch (sessionBeanType) {
                            case STATELESS:
                                mergeStatelessBean((StatelessComponentDescription) mergedBean, (StatelessComponentDescription) originalSessionBean, (StatelessComponentDescription) overrideSessionBean);
                                break;
                            case STATEFUL:
View Full Code Here

Examples of org.jboss.as.ejb3.component.session.SessionBeanComponentDescription

        if (sessionType == null) {
            throw new DeploymentUnitProcessingException("Unknown session-type for session bean: " + sessionBean.getName() + " in deployment unit: " + deploymentUnit);
        }
        String beanName = sessionBean.getName();
        String beanClassName = sessionBean.getEjbClass();
        SessionBeanComponentDescription sessionBeanDescription = null;
        switch (sessionType) {
            case Stateless:
                sessionBeanDescription = new StatelessComponentDescription(beanName, beanClassName, ejbJarDescription);
                break;
            case Stateful:
                sessionBeanDescription = new StatefulComponentDescription(beanName, beanClassName, ejbJarDescription);
                break;
            case Singleton:
                sessionBeanDescription = new SingletonComponentDescription(beanName, beanClassName, ejbJarDescription);
                break;
            default:
                throw new IllegalArgumentException("Unknown session bean type: " + sessionType);
        }
        // mapped-name
        sessionBeanDescription.setMappedName(sessionBean.getMappedName());
        // local business interface views
        BusinessLocalsMetaData businessLocals = sessionBean.getBusinessLocals();
        if (businessLocals != null && !businessLocals.isEmpty()) {
            sessionBeanDescription.addLocalBusinessInterfaceViews(businessLocals);
        }
        // remote business interface views
        BusinessRemotesMetaData businessRemotes = sessionBean.getBusinessRemotes();
        if (businessRemotes != null && !businessRemotes.isEmpty()) {
            sessionBeanDescription.addRemoteBusinessInterfaceViews(businessRemotes);
        }
        // tx management type
        if (sessionBean.getTransactionType() != null) {
            sessionBeanDescription.setTransactionManagementType(sessionBean.getTransactionType());
        }
        // CMT Tx attributes
        if (sessionBean.getTransactionType() != TransactionManagementType.BEAN) {
            ContainerTransactionsMetaData containerTransactions = sessionBean.getContainerTransactions();
            if (containerTransactions != null && !containerTransactions.isEmpty()) {
                for (ContainerTransactionMetaData containerTx : containerTransactions) {
                    TransactionAttributeType txAttr = containerTx.getTransAttribute();
                    MethodsMetaData methods = containerTx.getMethods();
                    for (MethodMetaData method : methods) {
                        String methodName = method.getMethodName();
                        MethodIntf methodIntf = this.getMethodIntf(method.getMethodIntf());
                        if (methodName.equals("*")) {
                            sessionBeanDescription.setTransactionAttribute(methodIntf, txAttr);
                        } else {

                            MethodParametersMetaData methodParams = method.getMethodParams();
                            // update the session bean description with the tx attribute info
                            sessionBeanDescription.setTransactionAttribute(methodIntf, txAttr, methodName, this.getMethodParams(methodParams));
                        }
                    }
                }
            }
        }
View Full Code Here

Examples of org.jboss.as.ejb3.component.session.SessionBeanComponentDescription

            final String beanClassName = sessionBeanClassInfo.name().toString();
            final String ejbName = sessionBeanClassInfo.name().local();
            final AnnotationValue nameValue = sessionBeanAnnotation.value("name");
            final String beanName = nameValue == null || nameValue.asString().isEmpty() ? ejbName : nameValue.asString();

            SessionBeanComponentDescription sessionBeanDescription = null;
            switch (sessionBeanType) {
                case STATELESS:
                    sessionBeanDescription = new StatelessComponentDescription(beanName, beanClassName, ejbJarDescription);
                    break;
                case STATEFUL:
                    sessionBeanDescription = new StatefulComponentDescription(beanName, beanClassName, ejbJarDescription);
                    break;
                case SINGLETON:
                    sessionBeanDescription = new SingletonComponentDescription(beanName, beanClassName, ejbJarDescription);
                    break;
                default:
                    throw new IllegalArgumentException("Unknown session bean type: " + sessionBeanType);
            }

            // Add this component description to module description
            if (ejbJarDescription.getEEModuleDescription().getComponentByName(sessionBeanDescription.getComponentName()) == null) {
                ejbJarDescription.getEEModuleDescription().addComponent(sessionBeanDescription);
            }
        }
    }
View Full Code Here

Examples of org.jboss.as.ejb3.component.session.SessionBeanComponentDescription

        }
    }

    private static EJBEndpoint newEjbEndpoint(final PortComponentMetaData portComponentMD, final EEModuleDescription moduleDescription, final Set<String> securityRoles) {
        final String ejbName = portComponentMD.getEjbLink();
        final SessionBeanComponentDescription sessionBean = (SessionBeanComponentDescription)moduleDescription.getComponentByName(ejbName);
        final String seiIfaceClassName = portComponentMD.getServiceEndpointInterface();
        final EJBViewDescription ejbViewDescription = sessionBean.addWebserviceEndpointView(seiIfaceClassName);
        // JSR 109 - Version 1.3 - 6.2.2.4 Security
        // For EJB based service implementations, Handlers run after method level authorization has occurred.
        // JSR 109 - Version 1.3 - 6.2.2.5 Transaction
        // Handlers run under the transaction context of the component they are associated with.
        sessionBean.getConfigurators().addLast(new JAXRPCHandlersConfigurator());
        final ServiceName ejbViewName = ejbViewDescription.getServiceName();

        return new EJBEndpoint(sessionBean, ejbViewName, securityRoles, null, false, null);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.