Package org.jboss.as.ee.component

Examples of org.jboss.as.ee.component.ComponentDescription


            for (final ServletMetaData servletMD : getServlets(jbossWebMD)) {
                if (endpointClassName.equals(getEndpointClassName(servletMD))) {
                    found = true;
                    // creating component description for POJO endpoint
                    final String endpointName = getEndpointName(servletMD);
                    final ComponentDescription pojoComponent = createComponentDescription(unit, endpointName, endpointClassName, endpointName);
                    final ServiceName pojoViewName = registerView(pojoComponent, endpointClassName);
                    // register POJO endpoint
                    final String urlPattern = getUrlPattern(endpointName, unit);
                    jaxwsDeployment.addEndpoint(new POJOEndpoint(endpointName, endpointClassName, pojoViewName, urlPattern));
                }
            }
            if (!found) {
                // JSR 109, version 1.3 final spec, section 5.3.2.1 javax.jws.WebService annotation
                final ComponentDescription pojoComponent = createComponentDescription(unit, endpointClassName, endpointClassName, endpointClassName);
                final ServiceName pojoViewName = registerView(pojoComponent, endpointClassName);
                // register POJO endpoint
                final String urlPattern = getUrlPattern(classInfo);
                jaxwsDeployment.addEndpoint(new POJOEndpoint(endpointClassName, pojoViewName, urlPattern));
            }
View Full Code Here


    static ComponentDescription createComponentDescription(final DeploymentUnit unit, final String componentName, final String componentClassName, final String dependsOnEndpointClassName) {
        final EEModuleDescription moduleDescription = getRequiredAttachment(unit, EE_MODULE_DESCRIPTION);
        // JBoss WEB processors may install fake components for WS endpoints - removing them forcibly
        moduleDescription.removeComponent(componentName, componentClassName);
        // register WS component
        ComponentDescription componentDescription = new WSComponentDescription(componentName, componentClassName, moduleDescription, unit.getServiceName());
        moduleDescription.addComponent(componentDescription);
        // register WS dependency
        final ServiceName endpointServiceName = EndpointService.getServiceName(unit, dependsOnEndpointClassName);
        componentDescription.addDependency(endpointServiceName, ServiceBuilder.DependencyType.REQUIRED);

        return componentDescription;
    }
View Full Code Here

            final String beanClassName = classInfo.name().toString();

            // Get the managed bean name from the annotation
            final AnnotationValue nameValue = instance.value();
            final String beanName = nameValue == null || nameValue.asString().isEmpty() ? beanClassName : nameValue.asString();
            final ComponentDescription componentDescription = new ComponentDescription(beanName, beanClassName, moduleDescription, moduleDescription.getOrAddClassByName(beanClassName), deploymentUnit.getServiceName());

            // Add the view
            ViewDescription viewDescription = new ViewDescription(componentDescription, beanClassName);
            viewDescription.getConfigurators().addFirst(new ViewConfigurator() {
                public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException {
                    // Add MB association interceptors
                    final Object contextKey = new Object();
                    configuration.addViewPostConstructInterceptor(new ManagedBeanCreateInterceptorFactory(contextKey), InterceptorOrder.ViewPostConstruct.INSTANCE_CREATE);
                    final ManagedBeanAssociatingInterceptorFactory associatingInterceptorFactory = new ManagedBeanAssociatingInterceptorFactory(contextKey);
                    configuration.addViewInterceptor(associatingInterceptorFactory, InterceptorOrder.View.ASSOCIATING_INTERCEPTOR);
                    configuration.addViewPreDestroyInterceptor(new ManagedBeanDestroyInterceptorFactory(contextKey), InterceptorOrder.ViewPreDestroy.INSTANCE_DESTROY);
                }
            });
            viewDescription.getBindingNames().addAll(Arrays.asList("java:module/" + beanName, "java:app/" + moduleDescription.getModuleName() + "/" + beanName));
            componentDescription.getViews().add(viewDescription);
            moduleDescription.addComponent(componentDescription);

            // register a EEResourceReferenceProcessor which can process @Resource references to this managed bean.
            EEResourceReferenceProcessorRegistry.registerResourceReferenceProcessor(new ManagedBeanResourceReferenceProcessor(beanClassName));
        }
View Full Code Here

            final String beanClassName = classInfo.name().toString();

            // Get the managed bean name from the annotation
            final AnnotationValue nameValue = instance.value();
            final String beanName = nameValue == null || nameValue.asString().isEmpty() ? beanClassName : nameValue.asString();
            final ComponentDescription componentDescription = new ComponentDescription(beanName, beanClassName, moduleDescription, deploymentUnit.getServiceName());

            // Add the view
            ViewDescription viewDescription = new ViewDescription(componentDescription, beanClassName);
            viewDescription.getConfigurators().addFirst(new ViewConfigurator() {
                public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException {
                    // Add MB association interceptors
                    final Object contextKey = new Object();
                    configuration.addClientPostConstructInterceptor(new ManagedBeanCreateInterceptorFactory(contextKey), InterceptorOrder.ClientPostConstruct.INSTANCE_CREATE);
                    final ManagedBeanAssociatingInterceptorFactory associatingInterceptorFactory = new ManagedBeanAssociatingInterceptorFactory(contextKey);
                    configuration.addClientInterceptor(associatingInterceptorFactory, InterceptorOrder.Client.ASSOCIATING_INTERCEPTOR);
                    configuration.addClientPreDestroyInterceptor(new ManagedBeanDestroyInterceptorFactory(contextKey), InterceptorOrder.ClientPreDestroy.INSTANCE_DESTROY);
                    configuration.addViewInterceptor(new ImmediateInterceptorFactory(new TCCLInterceptor(componentConfiguration.getModuleClassLoder())), InterceptorOrder.View.TCCL_INTERCEPTOR);
                }
            });
            viewDescription.getBindingNames().addAll(Arrays.asList("java:module/" + beanName, "java:app/" + moduleDescription.getModuleName() + "/" + beanName));
            componentDescription.getViews().add(viewDescription);
            moduleDescription.addComponent(componentDescription);

            // register a EEResourceReferenceProcessor which can process @Resource references to this managed bean.
            registry.registerResourceReferenceProcessor(new ManagedBeanResourceReferenceProcessor(beanClassName));
        }
View Full Code Here

            }
        }
    }

    private void installManagedBeanComponent(String className, final EEModuleDescription moduleDescription, final DeploymentUnit deploymentUnit) {
        final ComponentDescription componentDescription = new WebComponentDescription(MANAGED_BEAN.toString() + "." + className, className, moduleDescription, deploymentUnit.getServiceName());
        moduleDescription.addComponent(componentDescription);
        deploymentUnit.getAttachment(WebAttachments.WEB_COMPONENT_INSTANTIATORS).put(componentDescription.getComponentClassName(), new WebComponentInstantiator(deploymentUnit, componentDescription));
    }
View Full Code Here

        final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
        final TldsMetaData tldsMetaData = deploymentUnit.getAttachment(TldsMetaData.ATTACHMENT_KEY);
        final Set<String> classes = getAllComponentClasses(warMetaData, tldsMetaData);
        for (String clazz : classes) {
            ComponentDescription description = componentByClass.get(clazz);
            if (description != null) {
                //for now just make sure it has a single view
                //this will generally be a managed bean, but it could also be an EJB
                //TODO: make sure the component is a managed bean
                if (!(description.getViews().size() == 1)) {
                    throw new RuntimeException(clazz + " has the wrong component type, is cannot be used as a web component");
                }
                ManagedBeanComponentInstantiator instantiator = new ManagedBeanComponentInstantiator(deploymentUnit, description);
                webComponents.put(clazz, instantiator);
            } else {
View Full Code Here

        String componentClass = metadata.getBundleActivator();
        String componentName = BundleActivator.class.getSimpleName();
        EEModuleDescription moduleDescription = depUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
        if (moduleDescription != null) {
            ComponentDescription componentDescription = new ComponentDescription(componentName, componentClass, moduleDescription, depUnit.getServiceName());
            moduleDescription.addComponent(componentDescription);
        }
    }
View Full Code Here

        final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);

        final String beanName = mdb.getName();
        // the important bit is to skip already processed EJBs via annotations
        if (ejbJarDescription.hasComponent(beanName)) {
            final ComponentDescription description = eeModuleDescription.getComponentByName(beanName);
            if (description instanceof MessageDrivenComponentDescription) {
                ((MessageDrivenComponentDescription) description).setDescriptorData(mdb);
            } else {
                throw new DeploymentUnitProcessingException("MDB with name " + beanName + " referenced in ejb-jar.xml could not be created, as existing non MDB component with same name already exists: " + description);
            }
View Full Code Here

            for (final EJBEndpoint ejbEndpoint : getJaxwsEjbs(unit)) {
                if (endpointClassName.equals(ejbEndpoint.getClassName())) {
                    for (final String handlerClassName : mapping.getHandlers(endpointClassName)) {
                        final String ejbEndpointName = ejbEndpoint.getName();
                        final String handlerName = ejbEndpointName + "-" + handlerClassName;
                        final ComponentDescription jaxwsHandlerDescription = createComponentDescription(unit, handlerName, handlerClassName, ejbEndpointName);
                        propagateNamingContext(jaxwsHandlerDescription, ejbEndpoint);
                    }
                }
            }
        } else {
View Full Code Here

TOP

Related Classes of org.jboss.as.ee.component.ComponentDescription

Copyright © 2018 www.massapicom. 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.