Search in sources :

Example 1 with MicroProfileHealthReporter

use of org.wildfly.extension.microprofile.health.MicroProfileHealthReporter in project wildfly by wildfly.

the class DeploymentProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    Module module = deploymentUnit.getAttachment(Attachments.MODULE);
    final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    final WeldCapability weldCapability;
    try {
        weldCapability = support.getCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class);
    } catch (CapabilityServiceSupport.NoSuchCapabilityException e) {
        // We should not be here since the subsystem depends on weld capability. Just in case ...
        throw MicroProfileHealthLogger.LOGGER.deploymentRequiresCapability(deploymentUnit.getName(), WELD_CAPABILITY_NAME);
    }
    if (weldCapability.isPartOfWeldDeployment(deploymentUnit)) {
        final MicroProfileHealthReporter healthReporter = (MicroProfileHealthReporter) phaseContext.getServiceRegistry().getService(MicroProfileHealthSubsystemDefinition.HEALTH_REPORTER_SERVICE).getValue();
        weldCapability.registerExtensionInstance(new CDIExtension(healthReporter, module), deploymentUnit);
    }
}
Also used : MicroProfileHealthReporter(org.wildfly.extension.microprofile.health.MicroProfileHealthReporter) WeldCapability(org.jboss.as.weld.WeldCapability) Module(org.jboss.modules.Module) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Aggregations

CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 WeldCapability (org.jboss.as.weld.WeldCapability)1 Module (org.jboss.modules.Module)1 MicroProfileHealthReporter (org.wildfly.extension.microprofile.health.MicroProfileHealthReporter)1