Search in sources :

Example 61 with ComponentDescription

use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.

the class WSIntegrationProcessorJAXWS_EJB method processAnnotation.

@SuppressWarnings("rawtypes")
private static void processAnnotation(final DeploymentUnit unit, final Class annotationType) {
    final EEModuleDescription moduleDescription = getRequiredAttachment(unit, EE_MODULE_DESCRIPTION);
    final JAXWSDeployment jaxwsDeployment = getJaxwsDeployment(unit);
    for (EEModuleClassDescription description : moduleDescription.getClassDescriptions()) {
        @SuppressWarnings("unchecked") ClassAnnotationInformation classAnnotationInfo = description.getAnnotationInformation(annotationType);
        if (classAnnotationInfo != null && !classAnnotationInfo.getClassLevelAnnotations().isEmpty()) {
            Object obj = classAnnotationInfo.getClassLevelAnnotations().get(0);
            AnnotationTarget target = null;
            if (obj instanceof WebServiceAnnotationInfo) {
                target = ((WebServiceAnnotationInfo) obj).getTarget();
            } else if (obj instanceof WebServiceProviderAnnotationInfo) {
                target = ((WebServiceProviderAnnotationInfo) obj).getTarget();
            } else {
                return;
            }
            final ClassInfo webServiceClassInfo = (ClassInfo) target;
            final String webServiceClassName = webServiceClassInfo.name().toString();
            final List<ComponentDescription> componentDescriptions = moduleDescription.getComponentsByClassName(webServiceClassName);
            final List<SessionBeanComponentDescription> sessionBeans = getSessionBeans(componentDescriptions);
            // TODO: assembly processed for each endpoint!
            final Set<String> securityRoles = getDeclaredSecurityRoles(unit, webServiceClassInfo);
            final WebContextAnnotationWrapper webCtx = getWebContextWrapper(webServiceClassInfo);
            final String authMethod = webCtx.getAuthMethod();
            final boolean isSecureWsdlAccess = webCtx.isSecureWsdlAccess();
            final String transportGuarantee = webCtx.getTransportGuarantee();
            final String realmName = webCtx.getRealmName();
            for (final SessionBeanComponentDescription sessionBean : sessionBeans) {
                if (sessionBean.isStateless() || sessionBean.isSingleton()) {
                    final EJBViewDescription ejbViewDescription = sessionBean.addWebserviceEndpointView();
                    final ServiceName ejbViewName = ejbViewDescription.getServiceName();
                    jaxwsDeployment.addEndpoint(new EJBEndpoint(sessionBean, ejbViewName, securityRoles, authMethod, realmName, isSecureWsdlAccess, transportGuarantee));
                }
            }
        }
    }
}
Also used : AnnotationTarget(org.jboss.jandex.AnnotationTarget) SessionBeanComponentDescription(org.jboss.as.ejb3.component.session.SessionBeanComponentDescription) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) EJBViewDescription(org.jboss.as.ejb3.component.EJBViewDescription) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) ClassAnnotationInformation(org.jboss.as.ee.metadata.ClassAnnotationInformation) ServiceName(org.jboss.msc.service.ServiceName) EJBEndpoint(org.jboss.as.webservices.metadata.model.EJBEndpoint) JAXWSDeployment(org.jboss.as.webservices.metadata.model.JAXWSDeployment) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription) SessionBeanComponentDescription(org.jboss.as.ejb3.component.session.SessionBeanComponentDescription) ClassInfo(org.jboss.jandex.ClassInfo)

Example 62 with ComponentDescription

use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.

the class XTSInterceptorDeploymentProcessor method deploy.

public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    final EEModuleDescription moduleDescription = unit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
    for (ComponentDescription component : moduleDescription.getComponentDescriptions()) {
        if (component instanceof SessionBeanComponentDescription) {
            registerSessionBeanInterceptors((SessionBeanComponentDescription) component);
        }
        if (component instanceof WSComponentDescription) {
            registerWSPOJOInterceptors((WSComponentDescription) component);
        }
    }
}
Also used : ComponentDescription(org.jboss.as.ee.component.ComponentDescription) WSComponentDescription(org.jboss.as.webservices.injection.WSComponentDescription) SessionBeanComponentDescription(org.jboss.as.ejb3.component.session.SessionBeanComponentDescription) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) SessionBeanComponentDescription(org.jboss.as.ejb3.component.session.SessionBeanComponentDescription) WSComponentDescription(org.jboss.as.webservices.injection.WSComponentDescription)

Example 63 with ComponentDescription

use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.

the class EEJndiViewExtension method handleModule.

private void handleModule(final JndiViewExtensionContext context, final DeploymentUnit deploymentUnit, final ModelNode modulesNode, final ServiceRegistry serviceRegistry) throws OperationFailedException {
    final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
    // If it isn't an EE module, just return
    if (moduleDescription == null) {
        return;
    }
    final String appName = moduleDescription.getApplicationName();
    final String moduleName = moduleDescription.getModuleName();
    final ModelNode moduleNode = modulesNode.get(moduleDescription.getModuleName());
    final ServiceName moduleContextName = ContextNames.contextServiceNameOfModule(appName, moduleName);
    final ServiceController<?> moduleContextController = serviceRegistry.getService(moduleContextName);
    if (moduleContextController != null) {
        final NamingStore moduleStore = NamingStore.class.cast(moduleContextController.getValue());
        try {
            context.addEntries(moduleNode.get("java:module"), new NamingContext(moduleStore, null));
        } catch (NamingException e) {
            throw new OperationFailedException(e, new ModelNode().set(EeLogger.ROOT_LOGGER.failedToRead("java:module", appName, moduleName)));
        }
        final Collection<ComponentDescription> componentDescriptions = moduleDescription.getComponentDescriptions();
        for (ComponentDescription componentDescription : componentDescriptions) {
            final String componentName = componentDescription.getComponentName();
            final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(appName, moduleName, componentName);
            final ServiceController<?> compContextController = serviceRegistry.getService(compContextServiceName);
            if (compContextController != null) {
                final ModelNode componentNode = moduleNode.get("components").get(componentName);
                final NamingStore compStore = NamingStore.class.cast(compContextController.getValue());
                try {
                    context.addEntries(componentNode.get("java:comp"), new NamingContext(compStore, null));
                } catch (NamingException e) {
                    throw new OperationFailedException(e, new ModelNode().set(EeLogger.ROOT_LOGGER.failedToRead("java:comp", appName, moduleName, componentName)));
                }
            }
        }
    }
}
Also used : NamingStore(org.jboss.as.naming.NamingStore) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) ServiceName(org.jboss.msc.service.ServiceName) OperationFailedException(org.jboss.as.controller.OperationFailedException) NamingException(javax.naming.NamingException) ModelNode(org.jboss.dmr.ModelNode) NamingContext(org.jboss.as.naming.NamingContext)

Example 64 with ComponentDescription

use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.

the class InApplicationClientBindingProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
    if (moduleDescription == null) {
        return;
    }
    final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
    //if this is a war we need to bind to the modules comp namespace
    if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit) || DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) {
        final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(), moduleDescription.getModuleName());
        bindServices(deploymentUnit, serviceTarget, moduleContextServiceName);
    }
    for (ComponentDescription component : moduleDescription.getComponentDescriptions()) {
        if (component.getNamingMode() == ComponentNamingMode.CREATE) {
            final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(), moduleDescription.getModuleName(), component.getComponentName());
            bindServices(deploymentUnit, serviceTarget, compContextServiceName);
        }
    }
}
Also used : ComponentDescription(org.jboss.as.ee.component.ComponentDescription) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) ServiceName(org.jboss.msc.service.ServiceName) ServiceTarget(org.jboss.msc.service.ServiceTarget) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 65 with ComponentDescription

use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.

the class EEConcurrencyContextHandleFactoryProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
    if (eeModuleDescription == null) {
        return;
    }
    final ComponentConfigurator componentConfigurator = new ComponentConfigurator() {

        @Override
        public void configure(DeploymentPhaseContext context, ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException {
            final TransactionLeakContextHandleFactory transactionLeakContextHandleFactory = new TransactionLeakContextHandleFactory();
            context.addDependency(TransactionManagerService.SERVICE_NAME, TransactionManager.class, transactionLeakContextHandleFactory);
            configuration.getConcurrentContext().addFactory(transactionLeakContextHandleFactory);
        }
    };
    for (ComponentDescription componentDescription : eeModuleDescription.getComponentDescriptions()) {
        componentDescription.getConfigurators().add(componentConfigurator);
    }
}
Also used : ComponentConfiguration(org.jboss.as.ee.component.ComponentConfiguration) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) ComponentConfigurator(org.jboss.as.ee.component.ComponentConfigurator) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) DeploymentPhaseContext(org.jboss.as.server.deployment.DeploymentPhaseContext)

Aggregations

ComponentDescription (org.jboss.as.ee.component.ComponentDescription)65 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)45 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)44 ServiceName (org.jboss.msc.service.ServiceName)20 ComponentConfiguration (org.jboss.as.ee.component.ComponentConfiguration)19 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)18 Module (org.jboss.modules.Module)18 EJBComponentDescription (org.jboss.as.ejb3.component.EJBComponentDescription)17 ComponentConfigurator (org.jboss.as.ee.component.ComponentConfigurator)16 DeploymentPhaseContext (org.jboss.as.server.deployment.DeploymentPhaseContext)16 SessionBeanComponentDescription (org.jboss.as.ejb3.component.session.SessionBeanComponentDescription)15 DeploymentReflectionIndex (org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex)11 HashMap (java.util.HashMap)10 HashSet (java.util.HashSet)9 EEApplicationClasses (org.jboss.as.ee.component.EEApplicationClasses)9 ServiceTarget (org.jboss.msc.service.ServiceTarget)9 ImmediateInterceptorFactory (org.jboss.invocation.ImmediateInterceptorFactory)8 BindingConfiguration (org.jboss.as.ee.component.BindingConfiguration)5 DependencyConfigurator (org.jboss.as.ee.component.DependencyConfigurator)5 InterceptorDescription (org.jboss.as.ee.component.InterceptorDescription)5