Permalink
Comparing changes
Open a pull request
- 2 commits
- 67 files changed
- 0 commit comments
- 2 contributors
Commits on Apr 26, 2019
[WFLY-11186][WFLY-11187] Declare a capability for weld subsystem
Unified
Split
Showing
with
719 additions
and 169 deletions.
- +4 −0 batch-jberet/pom.xml
- +8 −7 ...jberet/src/main/java/org/wildfly/extension/batch/jberet/deployment/BatchEnvironmentProcessor.java
- +4 −0 bean-validation/pom.xml
- +12 −2 bean-validation/src/main/java/org/jboss/as/ee/beanvalidation/BeanValidationFactoryDeployer.java
- +0 −5 ee-security/pom.xml
- +2 −0 ee/src/main/java/org/jboss/as/ee/weld/WeldDeploymentMarker.java
- +0 −1 feature-pack/src/main/resources/modules/system/layers/base/org/jboss/as/ejb3/main/module.xml
- +2 −0 feature-pack/src/main/resources/modules/system/layers/base/org/jboss/as/jaxrs/main/module.xml
- +1 −2 feature-pack/src/main/resources/modules/system/layers/base/org/jboss/as/jpa/main/module.xml
- +2 −1 feature-pack/src/main/resources/modules/system/layers/base/org/jboss/as/jsf/main/module.xml
- +1 −0 ...ck/src/main/resources/modules/system/layers/base/org/jboss/as/weld/beanvalidation/main/module.xml
- +4 −0 feature-pack/src/main/resources/modules/system/layers/base/org/jboss/as/weld/main/module.xml
- +2 −0 .../src/main/resources/modules/system/layers/base/org/wildfly/extension/batch/jberet/main/module.xml
- +2 −0 ...c/main/resources/modules/system/layers/base/org/wildfly/extension/bean-validation/main/module.xml
- +0 −1 ...k/src/main/resources/modules/system/layers/base/org/wildfly/extension/ee-security/main/module.xml
- +2 −3 ...ain/resources/modules/system/layers/base/org/wildfly/extension/messaging-activemq/main/module.xml
- +1 −2 ...ces/modules/system/layers/base/org/wildfly/extension/microprofile/health-smallrye/main/module.xml
- +1 −1 galleon-pack/src/main/resources/feature_groups/basic-profile.xml
- +1 −0 galleon-pack/src/main/resources/layers/standalone/observability/layer-spec.xml
- +5 −0 jaxrs/pom.xml
- +9 −1 jaxrs/src/main/java/org/jboss/as/jaxrs/JaxrsSubsystemAdd.java
- +15 −9 jaxrs/src/main/java/org/jboss/as/jaxrs/deployment/JaxrsCdiIntegrationProcessor.java
- +10 −2 jaxrs/src/main/java/org/jboss/as/jaxrs/deployment/JaxrsComponentDeployer.java
- +11 −4 jaxrs/src/main/java/org/jboss/as/jaxrs/deployment/JaxrsDependencyProcessor.java
- +38 −30 jpa/subsystem/src/main/java/org/jboss/as/jpa/processor/PersistenceUnitServiceHandler.java
- +9 −5 jsf/subsystem/src/main/java/org/jboss/as/jsf/deployment/JSFCdiExtensionDeploymentProcessor.java
- +11 −2 jsf/subsystem/src/main/java/org/jboss/as/jsf/deployment/JSFDependencyProcessor.java
- +9 −1 jsf/subsystem/src/main/java/org/jboss/as/jsf/subsystem/JSFSubsystemAdd.java
- +1 −1 messaging-activemq/pom.xml
- +6 −1 messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/MessagingSubsystemAdd.java
- +15 −9 ...c/main/java/org/wildfly/extension/messaging/activemq/deployment/MessagingDependencyProcessor.java
- +9 −5 ...in/java/org/wildfly/extension/messaging/activemq/deployment/injection/CDIDeploymentProcessor.java
- +4 −0 microprofile/config-smallrye/pom.xml
- +16 −6 ...main/java/org/wildfly/extension/microprofile/config/smallrye/MicroProfileSubsystemDefinition.java
- +1 −5 microprofile/health-smallrye/pom.xml
- +4 −0 ...rc/main/java/org/wildfly/extension/microprofile/health/MicroProfileHealthSubsystemDefinition.java
- +3 −0 ...ye/src/main/java/org/wildfly/extension/microprofile/health/_private/MicroProfileHealthLogger.java
- +24 −8 ...llrye/src/main/java/org/wildfly/extension/microprofile/health/deployment/DeploymentProcessor.java
- +0 −8 microprofile/metrics-smallrye/pom.xml
- +1 −2 microprofile/opentracing-extension/pom.xml
- +14 −5 ...g-extension/src/main/java/org/wildfly/extension/microprofile/opentracing/SubsystemDefinition.java
- +22 −4 ...sion/src/main/java/org/wildfly/extension/microprofile/opentracing/TracingDeploymentProcessor.java
- +3 −0 ...xtension/src/main/java/org/wildfly/extension/microprofile/opentracing/TracingExtensionLogger.java
- +0 −5 picketlink/pom.xml
- +20 −5 ...ation/src/main/java/org/jboss/as/weld/deployment/processor/CdiBeanValidationFactoryProcessor.java
- +14 −2 ...n/src/main/java/org/jboss/as/weld/deployment/processor/WeldBeanValidationDependencyProcessor.java
- +31 −0 weld/common/src/main/java/org/jboss/as/weld/Capabilities.java
- +10 −0 weld/common/src/main/java/org/jboss/as/weld/ServiceNames.java
- +104 −0 weld/common/src/main/java/org/jboss/as/weld/WeldCapability.java
- +3 −0 weld/common/src/main/java/org/jboss/as/weld/deployment/WeldPortableExtensions.java
- +69 −0 weld/subsystem/src/main/java/org/jboss/as/weld/WeldCapabilityImpl.java
- +14 −7 weld/subsystem/src/main/java/org/jboss/as/weld/WeldResourceDefinition.java
- +70 −0 weld/subsystem/src/main/java/org/jboss/as/weld/_private/WeldDeploymentMarker.java
- +68 −0 weld/subsystem/src/main/java/org/jboss/as/weld/_private/WeldPortableExtensions.java
- +1 −1 weld/subsystem/src/main/java/org/jboss/as/weld/deployment/processors/BeanArchiveProcessor.java
- +1 −1 weld/subsystem/src/main/java/org/jboss/as/weld/deployment/processors/BeansXmlProcessor.java
- +2 −2 weld/subsystem/src/main/java/org/jboss/as/weld/deployment/processors/DevelopmentModeProcessor.java
- +1 −1 ...subsystem/src/main/java/org/jboss/as/weld/deployment/processors/ExternalBeanArchiveProcessor.java
- +1 −1 weld/subsystem/src/main/java/org/jboss/as/weld/deployment/processors/WebIntegrationProcessor.java
- +2 −2 ...system/src/main/java/org/jboss/as/weld/deployment/processors/WeldBeanManagerServiceProcessor.java
- +1 −1 ...stem/src/main/java/org/jboss/as/weld/deployment/processors/WeldComponentIntegrationProcessor.java
- +1 −1 weld/subsystem/src/main/java/org/jboss/as/weld/deployment/processors/WeldDependencyProcessor.java
- +1 −1 ...bsystem/src/main/java/org/jboss/as/weld/deployment/processors/WeldDeploymentCleanupProcessor.java
- +2 −2 weld/subsystem/src/main/java/org/jboss/as/weld/deployment/processors/WeldDeploymentProcessor.java
- +1 −1 ...system/src/main/java/org/jboss/as/weld/deployment/processors/WeldImplicitDeploymentProcessor.java
- +2 −2 ...bsystem/src/main/java/org/jboss/as/weld/deployment/processors/WeldPortableExtensionProcessor.java
- +11 −1 weld/subsystem/src/main/java/org/jboss/as/weld/services/BeanManagerService.java
| @@ -79,6 +79,10 @@ | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>wildfly-weld-spi</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>wildfly-weld-common</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.jboss.weld</groupId> | ||
| <artifactId>weld-core-impl</artifactId> | ||
| @@ -23,8 +23,7 @@ | ||
| package org.wildfly.extension.batch.jberet.deployment; | ||
|
|
||
| import static org.jboss.as.server.deployment.Attachments.DEPLOYMENT_COMPLETE_SERVICES; | ||
|
|
||
| import javax.enterprise.inject.spi.BeanManager; | ||
| import static org.jboss.as.weld.Capabilities.WELD_CAPABILITY_NAME; | ||
|
|
||
| import org.jberet.repository.JobRepository; | ||
| import org.jberet.spi.ArtifactFactory; | ||
| @@ -34,14 +33,14 @@ | ||
| import org.jboss.as.controller.capability.CapabilityServiceSupport; | ||
| import org.jboss.as.ee.structure.DeploymentType; | ||
| import org.jboss.as.ee.structure.DeploymentTypeMarker; | ||
| import org.jboss.as.ee.weld.WeldDeploymentMarker; | ||
| import org.jboss.as.server.Services; | ||
| import org.jboss.as.server.deployment.Attachments; | ||
| import org.jboss.as.server.deployment.DeploymentPhaseContext; | ||
| import org.jboss.as.server.deployment.DeploymentUnit; | ||
| import org.jboss.as.server.deployment.DeploymentUnitProcessingException; | ||
| import org.jboss.as.server.deployment.DeploymentUnitProcessor; | ||
| import org.jboss.as.server.suspend.SuspendController; | ||
| import org.jboss.as.weld.WeldCapability; | ||
| import org.jboss.modules.Module; | ||
| import org.jboss.msc.service.ServiceBuilder; | ||
| import org.jboss.msc.service.ServiceName; | ||
| @@ -135,10 +134,12 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU | ||
| final ServiceBuilder<ArtifactFactory> artifactFactoryServiceBuilder = serviceTarget.addService(artifactFactoryServiceName, artifactFactoryService); | ||
|
|
||
| // Register the bean manager if this is a CDI deployment | ||
| if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) { | ||
| BatchLogger.LOGGER.tracef("Adding BeanManager service dependency for deployment %s", deploymentUnit.getName()); | ||
| artifactFactoryServiceBuilder.addDependency(BatchServiceNames.beanManagerServiceName(deploymentUnit), BeanManager.class, | ||
| artifactFactoryService.getBeanManagerInjector()); | ||
| if (support.hasCapability(WELD_CAPABILITY_NAME)) { | ||
| final WeldCapability api = support.getOptionalCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class).get(); | ||
| if (api.isPartOfWeldDeployment(deploymentUnit)) { | ||
| BatchLogger.LOGGER.tracef("Adding BeanManager service dependency for deployment %s", deploymentUnit.getName()); | ||
| api.addBeanManagerService(deploymentUnit, artifactFactoryServiceBuilder, artifactFactoryService.getBeanManagerInjector()); | ||
| } | ||
| } | ||
| artifactFactoryServiceBuilder.install(); | ||
| serviceBuilder.addDependency(artifactFactoryServiceName, WildFlyArtifactFactory.class, service.getArtifactFactoryInjector()); | ||
| @@ -99,6 +99,10 @@ | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>wildfly-naming</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>wildfly-weld-common</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.wildfly.security</groupId> | ||
| <artifactId>wildfly-elytron</artifactId> | ||
| @@ -21,14 +21,16 @@ | ||
| */ | ||
| package org.jboss.as.ee.beanvalidation; | ||
|
|
||
| import static org.jboss.as.weld.Capabilities.WELD_CAPABILITY_NAME; | ||
|
|
||
| import javax.validation.ValidatorFactory; | ||
|
|
||
| import org.jboss.as.controller.capability.CapabilityServiceSupport; | ||
| import org.jboss.as.ee.component.ComponentDescription; | ||
| import org.jboss.as.ee.component.ComponentNamingMode; | ||
| import org.jboss.as.ee.component.EEModuleDescription; | ||
| import org.jboss.as.ee.structure.DeploymentType; | ||
| import org.jboss.as.ee.structure.DeploymentTypeMarker; | ||
| import org.jboss.as.ee.weld.WeldDeploymentMarker; | ||
| import org.jboss.as.naming.ServiceBasedNamingStore; | ||
| import org.jboss.as.naming.ValueManagedReferenceFactory; | ||
| import org.jboss.as.naming.deployment.ContextNames; | ||
| @@ -38,6 +40,7 @@ | ||
| import org.jboss.as.server.deployment.DeploymentUnit; | ||
| import org.jboss.as.server.deployment.DeploymentUnitProcessingException; | ||
| import org.jboss.as.server.deployment.DeploymentUnitProcessor; | ||
| import org.jboss.as.weld.WeldCapability; | ||
| import org.jboss.modules.Module; | ||
| import org.jboss.msc.service.ServiceName; | ||
| import org.jboss.msc.service.ServiceTarget; | ||
| @@ -114,7 +117,14 @@ private void bindServices(LazyValidatorFactory factory, ServiceTarget serviceTar | ||
| @Override | ||
| public void undeploy(DeploymentUnit context) { | ||
| ValidatorFactory validatorFactory = context.getAttachment(BeanValidationAttachments.VALIDATOR_FACTORY); | ||
| if ((validatorFactory != null) && (!WeldDeploymentMarker.isPartOfWeldDeployment(context))) { | ||
| final CapabilityServiceSupport support = context.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); | ||
|
|
||
| boolean partOfWeldDeployment = false; | ||
| if (support.hasCapability(WELD_CAPABILITY_NAME)) { | ||
| partOfWeldDeployment = support.getOptionalCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class) | ||
| .get().isPartOfWeldDeployment(context); | ||
| } | ||
| if (validatorFactory != null && !partOfWeldDeployment) { | ||
| // If the ValidatorFactory is not CDI-enabled, close it here. Otherwise, it's | ||
| // closed via CdiValidatorFactoryService before the Weld service is stopped. | ||
| validatorFactory.close(); | ||
| @@ -47,11 +47,6 @@ | ||
| <artifactId>wildfly-ee</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>wildfly-weld</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.jboss.logging</groupId> | ||
| <artifactId>jboss-logging</artifactId> | ||
| @@ -29,7 +29,9 @@ | ||
| * | ||
| * @author Stuart Douglas | ||
| * | ||
| * @deprecated Use WeldCapability to get access to the functionality of this class. | ||
| */ | ||
| @Deprecated | ||
| public class WeldDeploymentMarker { | ||
|
|
||
| private static final AttachmentKey<Boolean> MARKER = AttachmentKey.create(Boolean.class); | ||
| @@ -59,7 +59,6 @@ | ||
| <module name="org.wildfly.extension.request-controller"/> | ||
| <module name="org.wildfly.discovery"/> | ||
| <module name="org.jboss.as.controller"/> | ||
| <module name="org.jboss.as.weld"/> | ||
| <!-- So we can access its integration API --> | ||
| <module name="org.jboss.as.connector"/> | ||
| <!-- Need access to org.jboss.as.core.security.ServerSecurityManager --> | ||
| @@ -45,6 +45,8 @@ | ||
| <module name="org.wildfly.security.elytron-private"/> | ||
| <module name="org.jboss.as.server"/> | ||
| <module name="org.jboss.as.web-common"/> | ||
| <!-- Only used if capability org.wildfly.weld is available --> | ||
| <module name="org.jboss.as.weld.common" optional="true"/> | ||
| <module name="org.wildfly.extension.undertow"/> | ||
| <module name="io.undertow.core"/> | ||
| <module name="io.undertow.servlet"/> | ||
| @@ -70,8 +70,7 @@ | ||
| <module name="org.jboss.metadata.common"/> | ||
| <module name="org.jboss.vfs"/> | ||
| <module name="org.jboss.weld.core"/> | ||
| <!-- Optional; guarded by WeldDeploymentMarker which will not be present | ||
| if the weld subsystem isn't.--> | ||
| <!-- Only used if capability org.wildfly.weld is available --> | ||
| <module name="org.jboss.as.weld.common" optional="true"/> | ||
| <module name="org.wildfly.clustering.infinispan.spi"/> | ||
| <module name="org.wildfly.transaction.client"/> | ||
| @@ -44,7 +44,8 @@ | ||
| <module name="org.wildfly.security.elytron-private"/> | ||
| <module name="org.jboss.as.server"/> | ||
| <module name="org.jboss.as.web-common"/> | ||
| <module name="org.jboss.as.weld.common"/> | ||
| <!-- Only used if capability org.wildfly.weld is available --> | ||
| <module name="org.jboss.as.weld.common" optional="true"/> | ||
| <module name="org.jboss.jandex"/> | ||
| <module name="org.jboss.logging"/> | ||
| <module name="org.jboss.modules"/> | ||
| @@ -40,6 +40,7 @@ | ||
| <module name="org.jboss.as.server"/> | ||
| <module name="org.jboss.as.ee"/> | ||
| <module name="org.wildfly.security.elytron-private"/> | ||
| <module name="org.jboss.as.controller" /> | ||
| <module name="org.jboss.modules"/> | ||
| <module name="org.jboss.msc"/> | ||
| <module name="org.wildfly.extension.bean-validation"/> | ||
| @@ -28,6 +28,10 @@ | ||
| <property name="jboss.api" value="private"/> | ||
| </properties> | ||
|
|
||
| <exports> | ||
| <exclude path="org/jboss/as/weld/_private"/> | ||
| </exports> | ||
|
|
||
| <resources> | ||
| <artifact name="${org.wildfly:wildfly-weld}"/> | ||
| </resources> | ||
| @@ -46,6 +46,8 @@ | ||
| <module name="org.jboss.as.naming"/> | ||
| <module name="org.jboss.as.threads"/> | ||
| <module name="org.jboss.as.server"/> | ||
| <!-- Only used if capability org.wildfly.weld is available --> | ||
| <module name="org.jboss.as.weld.common" optional="true"/> | ||
| <module name="org.jboss.logging"/> | ||
| <module name="org.jboss.modules"/> | ||
| <module name="org.jboss.msc"/> | ||
| @@ -45,6 +45,8 @@ | ||
| <module name="org.jboss.as.controller"/> | ||
| <module name="org.jboss.as.ee"/> | ||
| <module name="org.jboss.as.naming" /> | ||
| <!-- Only used if capability org.wildfly.weld is available --> | ||
| <module name="org.jboss.as.weld.common" optional="true"/> | ||
| <module name="org.wildfly.security.elytron-private"/> | ||
| <module name="org.jboss.as.server" /> | ||
| <module name="org.jboss.modules"/> | ||
| @@ -48,7 +48,6 @@ | ||
| <module name="org.glassfish.soteria" /> | ||
| <module name="javax.security.enterprise.api" /> | ||
| <module name="javax.enterprise.api" /> | ||
| <module name="org.jboss.as.weld.common" /> | ||
| <module name="org.jboss.jandex"/> | ||
| </dependencies> | ||
| </module> | ||
| @@ -57,7 +57,8 @@ | ||
| <module name="org.wildfly.security.elytron-private"/> | ||
| <module name="org.wildfly.common"/> | ||
| <module name="org.jboss.as.server"/> | ||
| <module name="org.jboss.as.weld"/> | ||
| <!-- Only used if capability org.wildfly.weld is available --> | ||
| <module name="org.jboss.as.weld.common" optional="true"/> | ||
| <module name="org.jboss.jandex"/> | ||
| <module name="org.jboss.metadata.common"/> | ||
| <module name="org.jboss.modules"/> | ||
| @@ -74,9 +75,7 @@ | ||
| <module name="org.wildfly.naming-client" services="import" /> | ||
| <module name="org.jboss.threads"/> | ||
| <module name="org.wildfly.clustering.spi"/> | ||
| <module name="org.jboss.weld.api" /> | ||
| <module name="org.jboss.weld.core"/> | ||
| <module name="org.jboss.weld.spi" /> | ||
| <!-- org.jboss.xnio is required only if http-acceptor are used --> | ||
| <module name="org.jboss.xnio" optional="true" /> | ||
| <!-- org.jboss.xnio.netty.netty-xnio-transport is required only if http-acceptor are used --> | ||
| @@ -43,8 +43,7 @@ | ||
| <module name="org.jboss.logging"/> | ||
| <module name="org.jboss.vfs"/> | ||
| <module name="org.eclipse.microprofile.health.api"/> | ||
| <module name="org.jboss.as.weld" /> | ||
| <module name="org.jboss.as.ee" /> | ||
| <module name="org.jboss.as.weld.common" /> | ||
| <module name="javax.enterprise.api" /> | ||
| <module name="javax.annotation.api" /> | ||
| </dependencies> | ||
| @@ -104,12 +104,12 @@ | ||
| <feature spec="subsystem.jsf"/> | ||
| <feature spec="subsystem.jaxrs"/> | ||
| <feature spec="subsystem.jdr"/> | ||
| <feature spec="subsystem.weld"/> | ||
| <feature spec="subsystem.microprofile-config-smallrye"/> | ||
| <feature spec="subsystem.microprofile-opentracing-smallrye"/> | ||
| <feature spec="subsystem.pojo"/> | ||
| <feature spec="subsystem.sar"/> | ||
| <feature-group name="mail"/> | ||
| <feature-group name="webservices"/> | ||
| <feature spec="subsystem.weld"/> | ||
| <feature-group name="security-manager"/> | ||
| </feature-group-spec> | ||
| @@ -3,6 +3,7 @@ | ||
| <dependencies> | ||
| <layer name="web-server"/> | ||
| <layer name="management"/> | ||
| <layer name="cdi"/> | ||
| </dependencies> | ||
| <feature-group name="health"/> | ||
| <feature-group name="metrics"/> | ||
| @@ -67,6 +67,11 @@ | ||
| <artifactId>wildfly-web-common</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>wildfly-weld-common</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>wildfly-undertow</artifactId> | ||
| @@ -23,8 +23,11 @@ | ||
| package org.jboss.as.jaxrs; | ||
|
|
||
|
|
||
| import static org.jboss.as.weld.Capabilities.WELD_CAPABILITY_NAME; | ||
|
|
||
| import org.jboss.as.controller.AbstractBoottimeAddStepHandler; | ||
| import org.jboss.as.controller.OperationContext; | ||
| import org.jboss.as.controller.capability.CapabilityServiceSupport; | ||
| import org.jboss.as.controller.registry.Resource; | ||
| import org.jboss.as.jaxrs.deployment.JaxrsAnnotationProcessor; | ||
| import org.jboss.as.jaxrs.deployment.JaxrsCdiIntegrationProcessor; | ||
| @@ -66,8 +69,13 @@ public void execute(DeploymentProcessorTarget processorTarget) { | ||
| processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_JAXRS, new JaxrsDependencyProcessor()); | ||
| processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JAXRS_SCANNING, new JaxrsScanningProcessor()); | ||
| processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JAXRS_COMPONENT, new JaxrsComponentDeployer()); | ||
| processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JAXRS_CDI_INTEGRATION, new JaxrsCdiIntegrationProcessor()); | ||
|
|
||
| CapabilityServiceSupport capabilities = context.getCapabilityServiceSupport(); | ||
| if (capabilities.hasCapability(WELD_CAPABILITY_NAME)) { | ||
| processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JAXRS_CDI_INTEGRATION, new JaxrsCdiIntegrationProcessor()); | ||
| } | ||
| processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JAXRS_METHOD_PARAMETER, new JaxrsMethodParameterProcessor()); | ||
|
|
||
| processorTarget.addDeploymentProcessor(JaxrsExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_JAXRS_DEPLOYMENT, new JaxrsIntegrationProcessor()); | ||
| } | ||
| }, OperationContext.Stage.RUNTIME); | ||
| @@ -22,23 +22,25 @@ | ||
| package org.jboss.as.jaxrs.deployment; | ||
|
|
||
| import static org.jboss.as.jaxrs.logging.JaxrsLogger.JAXRS_LOGGER; | ||
| import static org.jboss.as.weld.Capabilities.WELD_CAPABILITY_NAME; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| import org.jboss.as.controller.capability.CapabilityServiceSupport; | ||
| import org.jboss.as.ee.structure.DeploymentType; | ||
| import org.jboss.as.ee.structure.DeploymentTypeMarker; | ||
| import org.jboss.as.ee.weld.WeldDeploymentMarker; | ||
| import org.jboss.as.server.deployment.Attachments; | ||
| import org.jboss.as.server.deployment.DeploymentPhaseContext; | ||
| import org.jboss.as.server.deployment.DeploymentUnit; | ||
| import org.jboss.as.server.deployment.DeploymentUnitProcessingException; | ||
| import org.jboss.as.server.deployment.DeploymentUnitProcessor; | ||
| import org.jboss.as.web.common.WarMetaData; | ||
| import org.jboss.as.weld.WeldCapability; | ||
| import org.jboss.metadata.javaee.spec.ParamValueMetaData; | ||
| import org.jboss.metadata.web.jboss.JBossWebMetaData; | ||
| import org.jboss.modules.Module; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * @author Stuart Douglas | ||
| */ | ||
| @@ -63,11 +65,15 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU | ||
| final JBossWebMetaData webdata = warMetaData.getMergedJBossWebMetaData(); | ||
|
|
||
| try { | ||
| module.getClassLoader().loadClass(CDI_INJECTOR_FACTORY_CLASS); | ||
| // don't set this param if CDI is not in classpath | ||
| if (WeldDeploymentMarker.isWeldDeployment(deploymentUnit)) { | ||
| JAXRS_LOGGER.debug("Found CDI, adding injector factory class"); | ||
| setContextParameter(webdata, "resteasy.injector.factory", CDI_INJECTOR_FACTORY_CLASS); | ||
| 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.isWeldDeployment(deploymentUnit)) { | ||
| // don't set this param if CDI is not in classpath | ||
| module.getClassLoader().loadClass(CDI_INJECTOR_FACTORY_CLASS); | ||
| JAXRS_LOGGER.debug("Found CDI, adding injector factory class"); | ||
| setContextParameter(webdata, "resteasy.injector.factory", CDI_INJECTOR_FACTORY_CLASS); | ||
| } | ||
| } | ||
| } catch (ClassNotFoundException ignored) { | ||
| } | ||
| @@ -23,19 +23,21 @@ | ||
| package org.jboss.as.jaxrs.deployment; | ||
|
|
||
| import static org.jboss.as.jaxrs.logging.JaxrsLogger.JAXRS_LOGGER; | ||
| import static org.jboss.as.weld.Capabilities.WELD_CAPABILITY_NAME; | ||
|
|
||
| import java.util.Arrays; | ||
|
|
||
| import org.jboss.as.controller.capability.CapabilityServiceSupport; | ||
| import org.jboss.as.ee.component.Attachments; | ||
| import org.jboss.as.ee.component.ComponentDescription; | ||
| import org.jboss.as.ee.component.EEModuleDescription; | ||
| import org.jboss.as.ee.component.ViewDescription; | ||
| import org.jboss.as.ee.managedbean.component.ManagedBeanComponentDescription; | ||
| import org.jboss.as.ee.weld.WeldDeploymentMarker; | ||
| import org.jboss.as.server.deployment.DeploymentPhaseContext; | ||
| import org.jboss.as.server.deployment.DeploymentUnit; | ||
| import org.jboss.as.server.deployment.DeploymentUnitProcessingException; | ||
| import org.jboss.as.server.deployment.DeploymentUnitProcessor; | ||
| import org.jboss.as.weld.WeldCapability; | ||
| import org.jboss.modules.Module; | ||
| import org.jboss.resteasy.util.GetRestful; | ||
|
|
||
| @@ -81,6 +83,12 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro | ||
|
|
||
| final ClassLoader loader = module.getClassLoader(); | ||
|
|
||
| final CapabilityServiceSupport support = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.CAPABILITY_SERVICE_SUPPORT); | ||
| boolean partOfWeldDeployment = false; | ||
| if (support.hasCapability(WELD_CAPABILITY_NAME)) { | ||
| partOfWeldDeployment = support.getOptionalCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class).get() | ||
| .isPartOfWeldDeployment(deploymentUnit); | ||
| } | ||
| for (final ComponentDescription component : moduleDescription.getComponentDescriptions()) { | ||
| Class<?> componentClass = null; | ||
| try { | ||
| @@ -95,7 +103,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro | ||
| //using SFSB's as JAX-RS endpoints is not recommended, but if people really want to do it they can | ||
|
|
||
| JAXRS_LOGGER.debugf("Stateful session bean %s is being used as a JAX-RS endpoint, this is not recommended", component.getComponentName()); | ||
| if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) { | ||
| if (partOfWeldDeployment) { | ||
| //if possible just let CDI handle the integration | ||
| continue; | ||
| } | ||
Oops, something went wrong.