Search in sources :

Example 71 with CapabilityServiceSupport

use of org.jboss.as.controller.capability.CapabilityServiceSupport in project wildfly by wildfly.

the class SecurityBootstrapDependencyInstaller method install.

@Override
public ServiceName install(ServiceTarget serviceTarget, DeploymentUnit deploymentUnit, boolean jtsEnabled) {
    final ServiceName serviceName = deploymentUnit.getServiceName().append(WeldSecurityServices.SERVICE_NAME);
    final CapabilityServiceSupport capabilities = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    final ServiceBuilder<?> sb = serviceTarget.addService(serviceName);
    final Consumer<SecurityServices> securityServicesConsumer = sb.provides(serviceName);
    sb.setInstance(new WeldSecurityServices(securityServicesConsumer));
    sb.install();
    return serviceName;
}
Also used : SecurityServices(org.jboss.weld.security.spi.SecurityServices) WeldSecurityServices(org.jboss.as.weld.services.bootstrap.WeldSecurityServices) ServiceName(org.jboss.msc.service.ServiceName) WeldSecurityServices(org.jboss.as.weld.services.bootstrap.WeldSecurityServices) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 72 with CapabilityServiceSupport

use of org.jboss.as.controller.capability.CapabilityServiceSupport in project wildfly by wildfly.

the class CdiBeanValidationFactoryProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final DeploymentUnit topLevelDeployment = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
    final ServiceName weldStartService = topLevelDeployment.getServiceName().append(ServiceNames.WELD_START_SERVICE_NAME);
    final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    final WeldCapability weldCapability;
    try {
        weldCapability = support.getCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class);
    } catch (CapabilityServiceSupport.NoSuchCapabilityException ignored) {
        return;
    }
    if (!weldCapability.isPartOfWeldDeployment(deploymentUnit)) {
        return;
    }
    if (!deploymentUnit.hasAttachment(BeanValidationAttachments.VALIDATOR_FACTORY)) {
        return;
    }
    final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
    final ServiceName serviceName = deploymentUnit.getServiceName().append(CdiValidatorFactoryService.SERVICE_NAME);
    final ServiceBuilder<?> sb = serviceTarget.addService(serviceName);
    final Supplier<BeanManager> beanManagerSupplier = weldCapability.addBeanManagerService(deploymentUnit, sb);
    sb.requires(weldStartService);
    sb.setInstance(new CdiValidatorFactoryService(deploymentUnit, beanManagerSupplier));
    sb.install();
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) ServiceTarget(org.jboss.msc.service.ServiceTarget) CdiValidatorFactoryService(org.jboss.as.weld.CdiValidatorFactoryService) WeldCapability(org.jboss.as.weld.WeldCapability) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) BeanManager(javax.enterprise.inject.spi.BeanManager) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 73 with CapabilityServiceSupport

use of org.jboss.as.controller.capability.CapabilityServiceSupport in project wildfly by wildfly.

the class EndpointService method isLegacySecurityDomain.

private static boolean isLegacySecurityDomain(DeploymentUnit unit, Endpoint endpoint, String domainName) {
    CapabilityServiceSupport capabilitySupport = unit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    if (capabilitySupport != null && !capabilitySupport.hasCapability(LEGACY_SECURITY_CAPABILITY)) {
        return false;
    }
    final ServiceName serviceName = SECURITY_DOMAIN_SERVICE.append(domainName);
    return currentServiceContainer().getService(serviceName) != null;
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 74 with CapabilityServiceSupport

use of org.jboss.as.controller.capability.CapabilityServiceSupport in project wildfly by wildfly.

the class EndpointService method isElytronSecurityDomain.

private static boolean isElytronSecurityDomain(DeploymentUnit unit, Endpoint endpoint, String domainName) {
    CapabilityServiceSupport capabilitySupport = unit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    if (capabilitySupport != null && !capabilitySupport.hasCapability(ELYTRON_SECURITY_CAPABILITY)) {
        return false;
    }
    final ServiceName serviceName;
    if (EndpointType.JAXWS_EJB3.equals(endpoint.getType())) {
        serviceName = EJB_APPLICATION_SECURITY_DOMAIN_RUNTIME_CAPABILITY.getCapabilityServiceName(domainName, ApplicationSecurityDomainService.ApplicationSecurityDomain.class);
    } else {
        serviceName = ServiceNameFactory.parseServiceName(WEB_APPLICATION_SECURITY_DOMAIN).append(domainName).append(Constants.SECURITY_DOMAIN);
    }
    return currentServiceContainer().getService(serviceName) != null;
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) ApplicationSecurityDomain(org.jboss.as.ejb3.subsystem.ApplicationSecurityDomainService.ApplicationSecurityDomain) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Aggregations

CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)74 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)39 ServiceName (org.jboss.msc.service.ServiceName)36 ServiceTarget (org.jboss.msc.service.ServiceTarget)23 WeldCapability (org.jboss.as.weld.WeldCapability)19 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)18 Module (org.jboss.modules.Module)16 ServiceBuilder (org.jboss.msc.service.ServiceBuilder)14 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)10 HashMap (java.util.HashMap)9 DeploymentPhaseContext (org.jboss.as.server.deployment.DeploymentPhaseContext)9 ComponentConfiguration (org.jboss.as.ee.component.ComponentConfiguration)8 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)8 ValidatorFactory (javax.validation.ValidatorFactory)7 ModuleSpecification (org.jboss.as.server.deployment.module.ModuleSpecification)7 HashSet (java.util.HashSet)6 TransactionSynchronizationRegistry (javax.transaction.TransactionSynchronizationRegistry)6 ComponentConfigurator (org.jboss.as.ee.component.ComponentConfigurator)6 ModelNode (org.jboss.dmr.ModelNode)6 ModuleLoader (org.jboss.modules.ModuleLoader)6