Interface WeldCapability
- Author:
- Yeray Borges
-
Method Summary
Modifier and TypeMethodDescriptionSupplier<jakarta.enterprise.inject.spi.BeanManager>addBeanManagerService(org.jboss.as.server.deployment.DeploymentUnit unit, org.jboss.msc.service.ServiceBuilder<?> serviceBuilder) Adds the Bean Manager service associated to theDeploymentUnitto ServiceBuilder passed as argument.org.jboss.msc.service.ServiceBuilder<?>addBeanManagerService(org.jboss.as.server.deployment.DeploymentUnit unit, org.jboss.msc.service.ServiceBuilder<?> serviceBuilder, org.jboss.msc.inject.Injector<jakarta.enterprise.inject.spi.BeanManager> targetInjector) Adds the Bean Manager service associated to theDeploymentUnitto ServiceBuilder passed as argument.booleanisPartOfWeldDeployment(org.jboss.as.server.deployment.DeploymentUnit unit) Returns true if theDeploymentUnitis part of a weld deployment.booleanisWeldDeployment(org.jboss.as.server.deployment.DeploymentUnit unit) Returns true if theDeploymentUnithas a beans.xml in any of it's resource roots, or is a top level deployment that contains sub-deployments that are weld deployments.voidmarkAsWeldDeployment(org.jboss.as.server.deployment.DeploymentUnit unit) Registers a deployment as a Weld deployment, even in the absence of spec-compliant configuration files or annotations.voidregisterBuildCompatibleExtension(Class<? extends jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension> extension, org.jboss.as.server.deployment.DeploymentUnit unit) Registers a CDI Build Compatible Extension for theDeploymentUnitpassed as argument to this method.voidregisterExtensionInstance(jakarta.enterprise.inject.spi.Extension extension, org.jboss.as.server.deployment.DeploymentUnit unit) Registers a CDI Portable Extension for theDeploymentUnitpassed as argument to this method.
-
Method Details
-
registerExtensionInstance
void registerExtensionInstance(jakarta.enterprise.inject.spi.Extension extension, org.jboss.as.server.deployment.DeploymentUnit unit) Registers a CDI Portable Extension for theDeploymentUnitpassed as argument to this method.The extension is registered if and only if the DeploymentUnit is part of a Weld Deployment. Specifically, if a call to
isPartOfWeldDeployment(DeploymentUnit)using the DeploymentUnit argument returnstrue. Otherwise, this method will return immediately.- Parameters:
extension- An instance of the CDI portable extension to add.unit- The deployment unit where the extension will be registered.
-
registerBuildCompatibleExtension
void registerBuildCompatibleExtension(Class<? extends jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension> extension, org.jboss.as.server.deployment.DeploymentUnit unit) Registers a CDI Build Compatible Extension for theDeploymentUnitpassed as argument to this method.The extension is registered if and only if the DeploymentUnit is part of a Weld Deployment. Specifically, if a call to
isPartOfWeldDeployment(DeploymentUnit)using the DeploymentUnit argument returnstrue. Otherwise, this method will return immediately.- Parameters:
extension- An instance of the CDI portable extension to add.unit- The deployment unit where the extension will be registered.
-
addBeanManagerService
Supplier<jakarta.enterprise.inject.spi.BeanManager> addBeanManagerService(org.jboss.as.server.deployment.DeploymentUnit unit, org.jboss.msc.service.ServiceBuilder<?> serviceBuilder) Adds the Bean Manager service associated to theDeploymentUnitto ServiceBuilder passed as argument.The Bean Manager service is added if only if the DeploymentUnit is part of a Weld Deployment. Specifically, if a call to
isPartOfWeldDeployment(DeploymentUnit)using the DeploymentUnit argument returnstrue. Otherwise this method will returnnull.- Parameters:
unit- DeploymentUnit used to get the Bean Manager service name. Cannot be null.serviceBuilder- The service builder used to add the dependency. Cannot be null.- Returns:
- A supplier that contains the BeanManager instance if the DeploymentUnit is part of a Weld Deployment, otherwise
returns
null. - Throws:
IllegalStateException- if this method have been called afterServiceBuilder.setInstance(org.jboss.msc.Service)method.UnsupportedOperationException- if this service builder wasn't created viaServiceTarget.addService(ServiceName)method.
-
addBeanManagerService
org.jboss.msc.service.ServiceBuilder<?> addBeanManagerService(org.jboss.as.server.deployment.DeploymentUnit unit, org.jboss.msc.service.ServiceBuilder<?> serviceBuilder, org.jboss.msc.inject.Injector<jakarta.enterprise.inject.spi.BeanManager> targetInjector) Adds the Bean Manager service associated to theDeploymentUnitto ServiceBuilder passed as argument. Use this method to add the service dependency for legacy msc services.The Bean Manager service is added if only if the DeploymentUnit is part of a Weld Deployment. Specifically, if a call to
isPartOfWeldDeployment(DeploymentUnit)using the DeploymentUnit argument returnstrue. Otherwise this method will return immediately without applying any modification to the serviceBuilder.- Parameters:
unit-DeploymentUnitused to get the Bean Manager service name. Cannot be null.serviceBuilder- The service builder used to add the dependency. Cannot be null.targetInjector- the injector into which the dependency should be stored. Cannot be null.- Returns:
- the ServiceBuilder with the Bean Manager service added.
- Throws:
UnsupportedOperationException- if the service builder was created viaServiceTarget.addService(ServiceName)method.
-
isPartOfWeldDeployment
boolean isPartOfWeldDeployment(org.jboss.as.server.deployment.DeploymentUnit unit) Returns true if theDeploymentUnitis part of a weld deployment.- Parameters:
unit-DeploymentUnitto check.- Returns:
- true if the
DeploymentUnitis part of a weld deployment.
-
isWeldDeployment
boolean isWeldDeployment(org.jboss.as.server.deployment.DeploymentUnit unit) Returns true if theDeploymentUnithas a beans.xml in any of it's resource roots, or is a top level deployment that contains sub-deployments that are weld deployments.- Parameters:
unit-DeploymentUnitto check.- Returns:
- true if the
DeploymentUnithas a beans.xml in any of it's resource roots, or is a top level deployment that contains sub-deployments that are weld deployments.
-
markAsWeldDeployment
void markAsWeldDeployment(org.jboss.as.server.deployment.DeploymentUnit unit) Registers a deployment as a Weld deployment, even in the absence of spec-compliant configuration files or annotations. After a call to this method, calls toisWeldDeployment(DeploymentUnit unit)will return true.
-