Search in sources :

Example 66 with CapabilityServiceSupport

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

the class TracingDeploymentProcessor method getTracerConfiguration.

private String getTracerConfiguration(DeploymentPhaseContext deploymentPhaseContext) {
    DeploymentUnit deploymentUnit = deploymentPhaseContext.getDeploymentUnit();
    JBossWebMetaData jbossWebMetaData = getJBossWebMetaData(deploymentUnit);
    if (null == jbossWebMetaData || null == jbossWebMetaData.getContextParams()) {
        return null;
    }
    for (ParamValueMetaData param : jbossWebMetaData.getContextParams()) {
        if (SMALLRYE_OPENTRACING_TRACER_CONFIGURATION.equals(param.getParamName())) {
            String value = param.getParamValue();
            if (value != null && !value.isEmpty()) {
                return TRACER_CAPABILITY.getDynamicName(param.getParamValue());
            }
        }
    }
    final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    if (support.hasCapability(DEFAULT_TRACER_CAPABILITY_NAME)) {
        return WildFlyTracerFactory.getDefaultTracerName();
    }
    return null;
}
Also used : ParamValueMetaData(org.jboss.metadata.javaee.spec.ParamValueMetaData) JBossWebMetaData(org.jboss.metadata.web.jboss.JBossWebMetaData) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 67 with CapabilityServiceSupport

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

the class TracingDependencyProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    addDependencies(deploymentUnit);
    final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    if (support.hasCapability(DEFAULT_TRACER_CAPABILITY_NAME)) {
        phaseContext.getServiceTarget().addDependency(DEFAULT_TRACER_CAPABILITY.getCapabilityServiceName());
    }
    ServiceName tracerConfiguration = getTracerConfigurationServiceDependency(phaseContext);
    if (tracerConfiguration != null) {
        phaseContext.getServiceTarget().addDependency(tracerConfiguration);
    }
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 68 with CapabilityServiceSupport

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

the class ReactiveMessagingDependencyProcessor method ignorePrecalulatedJandex.

@SuppressWarnings("deprecation")
private void ignorePrecalulatedJandex(DeploymentUnit deploymentUnit, String... modules) {
    final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    if (support.hasCapability(WELD_CAPABILITY_NAME)) {
        WeldCapability weld = support.getOptionalCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class).get();
        weld.ignorePrecalculatedJandexForModules(deploymentUnit, modules);
    }
}
Also used : WeldCapability(org.jboss.as.weld.WeldCapability) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 69 with CapabilityServiceSupport

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

the class JndiNamingDependencyProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    ServiceName namingStoreServiceName = support.getCapabilityServiceName(NamingService.CAPABILITY_NAME);
    // this will always be up but we need to make sure the naming service is
    // not shut down before the deployment is undeployed when the container is shut down
    phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, namingStoreServiceName);
    final ServiceName serviceName = serviceName(deploymentUnit.getServiceName());
    final ServiceBuilder<?> serviceBuilder = phaseContext.getServiceTarget().addService(serviceName, new RuntimeBindReleaseService());
    addAllDependencies(serviceBuilder, deploymentUnit.getAttachmentList(Attachments.JNDI_DEPENDENCIES));
    Map<ServiceName, Set<ServiceName>> compJndiDeps = deploymentUnit.getAttachment(Attachments.COMPONENT_JNDI_DEPENDENCIES);
    Set<ServiceName> aggregatingServices = installComponentJndiAggregatingServices(phaseContext.getServiceTarget(), compJndiDeps);
    addAllDependencies(serviceBuilder, aggregatingServices);
    if (deploymentUnit.getParent() != null) {
        addAllDependencies(serviceBuilder, deploymentUnit.getParent().getAttachment(Attachments.JNDI_DEPENDENCIES));
        compJndiDeps = deploymentUnit.getParent().getAttachment(Attachments.COMPONENT_JNDI_DEPENDENCIES);
        aggregatingServices = installComponentJndiAggregatingServices(phaseContext.getServiceTarget(), compJndiDeps);
        addAllDependencies(serviceBuilder, aggregatingServices);
    }
    serviceBuilder.requires(namingStoreServiceName);
    serviceBuilder.install();
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) ServiceName(org.jboss.msc.service.ServiceName) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 70 with CapabilityServiceSupport

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

the class EarApplicationScopedObserverMethodProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
        // ear deployment only processor
        return;
    }
    final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    if (support.hasCapability(WELD_CAPABILITY_NAME)) {
        final WeldCapability api = support.getOptionalCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class).get();
        if (api.isPartOfWeldDeployment(deploymentUnit)) {
            api.registerExtensionInstance(new PortableExtension(deploymentUnit), deploymentUnit);
        }
    }
}
Also used : WeldCapability(org.jboss.as.weld.WeldCapability) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) 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