Examples of SessionBeanComponentDescription


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

                final EJBViewDescription ejbView = (EJBViewDescription) view;

                ejbView.getConfigurators().add(new ViewConfigurator() {
                    @Override
                    public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException {
                        final SessionBeanComponentDescription componentDescription = (SessionBeanComponentDescription) componentConfiguration.getComponentDescription();
                        for (final Method method : configuration.getProxyFactory().getCachedMethods()) {

                            //we need the component method to get the correct declaring class
                            final Method componentMethod = ClassReflectionIndexUtil.findMethod(deploymentReflectionIndex, componentClass, method);

                            if (componentMethod != null) {
                                if (componentDescription.getAsynchronousClasses().contains(componentMethod.getDeclaringClass().getName())) {
                                    addAsyncInterceptor(configuration, method);
                                    configuration.addAsyncMethod(method);
                                } else {
                                    MethodIdentifier id = MethodIdentifier.getIdentifierForMethod(method);
                                    if (componentDescription.getAsynchronousMethods().contains(id)) {
                                        addAsyncInterceptor(configuration, method);
                                        configuration.addAsyncMethod(method);
                                    }
                                }
                            }
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

        }
    }

    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 String ejbViewName = ejbViewDescription.getServiceName().getCanonicalName();

        return new EJBEndpoint(sessionBean, ejbViewName, securityRoles, null, false, null);
    }
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

            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, moduleDescription.getModuleName(), applicationName);
                    break;
                case STATEFUL:
View Full Code Here

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

        }
        // Only process EJB deployments
        if (!EjbDeploymentMarker.isEjbDeployment(deploymentUnit) || !(componentDescription instanceof SessionBeanComponentDescription)) {
            return;
        }
        SessionBeanComponentDescription sessionBeanComponentDescription = (SessionBeanComponentDescription) componentDescription;
        // TODO: We should only pick up EJB3.1 deployments for @LocalBean processing
        if (!this.hasNoInterfaceView(sessionBeanClass)) {
            if (logger.isTraceEnabled()) {
                logger.trace("Session bean: " + sessionBeanComponentDescription.getEJBName() + " doesn't have a no-interface view");
            }
            return;
        }
        // add the no-interface view to the component description
        sessionBeanComponentDescription.addNoInterfaceView();

        // create the jndi bindings for the no-interface view

        // In case of EJB bindings, appname == .ear file name (if it's an .ear deployment)
        String applicationName = this.getEarName(deploymentUnit);
        String globalJNDIBaseName = "java:global/" + (applicationName != null ? applicationName + "/" : "") + sessionBeanComponentDescription.getModuleName() + "/" + sessionBeanComponentDescription.getEJBName();
        String appJNDIBaseName = "java:app/" + sessionBeanComponentDescription.getModuleName() + "/" + sessionBeanComponentDescription.getEJBName();
        String moduleJNDIBaseName = "java:module/" + sessionBeanComponentDescription.getEJBName();

        // the base ServiceName which will be used to create the ServiceName(s) for each of the view bindings
        ServiceName baseServiceName = deploymentUnit.getServiceName().append("component").append(sessionBeanComponentDescription.getComponentName());
        String ejbClassName = sessionBeanComponentDescription.getEJBClassName();
        // now create the bindings
        final BindingDescription globalBinding = new BindingDescription();
        globalBinding.setAbsoluteBinding(true);
        String globalJNDIName = globalJNDIBaseName + "!" + ejbClassName;
        globalBinding.setBindingName(globalJNDIName);
        globalBinding.setBindingType(ejbClassName);
        globalBinding.setReferenceSourceDescription(new ServiceBindingSourceDescription(baseServiceName.append("VIEW").append(ejbClassName)));
        // add the binding to the component description
        componentDescription.getBindings().add(globalBinding);
        logger.debug("Added java:global jndi binding at " + globalJNDIName + " for no-interface view of session bean: " + sessionBeanComponentDescription.getEJBName());

        // java:app bindings
        final BindingDescription appBinding = new BindingDescription();
        appBinding.setAbsoluteBinding(true);
        String appJNDIName = appJNDIBaseName + "!" + ejbClassName;
        appBinding.setBindingName(appJNDIName);
        appBinding.setBindingType(ejbClassName);
        appBinding.setReferenceSourceDescription(new ServiceBindingSourceDescription(baseServiceName.append("VIEW").append(ejbClassName)));
        // add the binding to the component description
        componentDescription.getBindings().add(appBinding);
        logger.debug("Added java:app jndi binding at " + appJNDIName + " for no-interface view of session bean: " + sessionBeanComponentDescription.getEJBName());

        // java:module bindings
        final BindingDescription moduleBinding = new BindingDescription();
        moduleBinding.setAbsoluteBinding(true);
        String moduleJNDIName = moduleJNDIBaseName + "!" + ejbClassName;
        moduleBinding.setBindingName(moduleJNDIName);
        moduleBinding.setBindingType(ejbClassName);
        moduleBinding.setReferenceSourceDescription(new ServiceBindingSourceDescription(baseServiceName.append("VIEW").append(ejbClassName)));
        // add the binding to the component description
        componentDescription.getBindings().add(moduleBinding);
        logger.debug("Added java:module jndi binding at " + moduleJNDIName + " for no-interface view of session bean: " + sessionBeanComponentDescription.getEJBName());

    }
View Full Code Here

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

        }
        // Only process EJB deployments
        if (!EjbDeploymentMarker.isEjbDeployment(deploymentUnit) || !(componentDescription instanceof SessionBeanComponentDescription)) {
            return;
        }
        SessionBeanComponentDescription sessionBeanComponentDescription = (SessionBeanComponentDescription) componentDescription;
        // fetch the local business interfaces of the bean
        Collection<String> localBusinessInterfaces = this.getLocalBusinessInterfaces(sessionBeanComponentDescription, compositeIndex, sessionBeanClass);
        if (logger.isTraceEnabled()) {
            logger.trace("Session bean: " + sessionBeanComponentDescription.getEJBName() + " has " + localBusinessInterfaces.size() + " local business interfaces namely: " + localBusinessInterfaces);
        }
        // add it to the component description
        sessionBeanComponentDescription.addLocalBusinessInterfaceViews(localBusinessInterfaces);

        // In case of EJB bindings, appname == .ear file name (if it's an .ear deployment)
        String applicationName = this.getEarName(deploymentUnit);
        String globalJNDIBaseName = "java:global/" + (applicationName != null ? applicationName + "/" : "") + sessionBeanComponentDescription.getModuleName() + "/" + sessionBeanComponentDescription.getEJBName();
        String appJNDIBaseName = "java:app/" + sessionBeanComponentDescription.getModuleName() + "/" + sessionBeanComponentDescription.getEJBName();
        String moduleJNDIBaseName = "java:module/" + sessionBeanComponentDescription.getEJBName();

        // the base ServiceName which will be used to create the ServiceName(s) for each of the view bindings
        ServiceName baseServiceName = deploymentUnit.getServiceName().append("component").append(sessionBeanComponentDescription.getComponentName());
        // now create the bindings
        for (String viewClassName : localBusinessInterfaces) {
            final BindingDescription globalBinding = new BindingDescription();
            globalBinding.setAbsoluteBinding(true);
            String globalJNDIName = globalJNDIBaseName + "!" + viewClassName;
            globalBinding.setBindingName(globalJNDIName);
            globalBinding.setBindingType(viewClassName);
            globalBinding.setReferenceSourceDescription(new ServiceBindingSourceDescription(baseServiceName.append("VIEW").append(viewClassName)));
            // add the binding to the component description
            componentDescription.getBindings().add(globalBinding);
            logger.debug("Added java:global jndi binding at " + globalJNDIName + " for local view: " + viewClassName + " of session bean: " + sessionBeanComponentDescription.getEJBName());

            // java:app bindings
            final BindingDescription appBinding = new BindingDescription();
            appBinding.setAbsoluteBinding(true);
            String appJNDIName = appJNDIBaseName + "!" + viewClassName;
            appBinding.setBindingName(appJNDIName);
            appBinding.setBindingType(viewClassName);
            appBinding.setReferenceSourceDescription(new ServiceBindingSourceDescription(baseServiceName.append("VIEW").append(viewClassName)));
            // add the binding to the component description
            componentDescription.getBindings().add(appBinding);
            logger.debug("Added java:app jndi binding at " + appJNDIName + " for local view: " + viewClassName + " of session bean: " + sessionBeanComponentDescription.getEJBName());

            // java:module bindings
            final BindingDescription moduleBinding = new BindingDescription();
            moduleBinding.setAbsoluteBinding(true);
            String moduleJNDIName = moduleJNDIBaseName + "!" + viewClassName;
            moduleBinding.setBindingName(moduleJNDIName);
            moduleBinding.setBindingType(viewClassName);
            moduleBinding.setReferenceSourceDescription(new ServiceBindingSourceDescription(baseServiceName.append("VIEW").append(viewClassName)));
            // add the binding to the component description
            componentDescription.getBindings().add(moduleBinding);
            logger.debug("Added java:module jndi binding at " + moduleJNDIName + " for local view: " + viewClassName + " of session bean: " + sessionBeanComponentDescription.getEJBName());

        }

    }
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

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

        if (componentDescription instanceof SessionBeanComponentDescription) {
            final SessionBeanComponentDescription ejbComponentDescription = (SessionBeanComponentDescription) componentDescription;

            //check for EJB's with a local home interface
            if (ejbComponentDescription.getEjbLocalHomeView() != null) {
                final EJBViewDescription view = ejbComponentDescription.getEjbLocalHomeView();
                final EJBViewDescription ejbLocalView = ejbComponentDescription.getEjbLocalView();
                configureHome(phaseContext, componentDescription, ejbComponentDescription, view, ejbLocalView);
            }
            if (ejbComponentDescription.getEjbHomeView() != null) {
                final EJBViewDescription view = ejbComponentDescription.getEjbHomeView();
                final EJBViewDescription ejbRemoteView = ejbComponentDescription.getEjbRemoteView();
                configureHome(phaseContext, componentDescription, ejbComponentDescription, view, ejbRemoteView);
            }
        }
    }
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.