Search in sources :

Example 1 with WeldPortableExtensions

use of org.jboss.as.weld.deployment.WeldPortableExtensions in project wildfly by wildfly.

the class PersistenceUnitServiceHandler method registerJPAEntityListenerRegister.

private static BeanManagerAfterDeploymentValidation registerJPAEntityListenerRegister(DeploymentUnit deploymentUnit) {
    deploymentUnit = DeploymentUtils.getTopDeploymentUnit(deploymentUnit);
    if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
        synchronized (deploymentUnit) {
            BeanManagerAfterDeploymentValidation beanManagerAfterDeploymentValidation = deploymentUnit.getAttachment(JpaAttachments.BEAN_MANAGER_AFTER_DEPLOYMENT_VALIDATION_ATTACHMENT_KEY);
            if (null == beanManagerAfterDeploymentValidation) {
                beanManagerAfterDeploymentValidation = new BeanManagerAfterDeploymentValidation();
                deploymentUnit.putAttachment(JpaAttachments.BEAN_MANAGER_AFTER_DEPLOYMENT_VALIDATION_ATTACHMENT_KEY, beanManagerAfterDeploymentValidation);
                WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(deploymentUnit);
                extensions.registerExtensionInstance(beanManagerAfterDeploymentValidation, deploymentUnit);
            }
            return beanManagerAfterDeploymentValidation;
        }
    } else {
        return new BeanManagerAfterDeploymentValidation(true);
    }
}
Also used : WeldPortableExtensions(org.jboss.as.weld.deployment.WeldPortableExtensions) BeanManagerAfterDeploymentValidation(org.jboss.as.jpa.beanmanager.BeanManagerAfterDeploymentValidation)

Example 2 with WeldPortableExtensions

use of org.jboss.as.weld.deployment.WeldPortableExtensions in project wildfly by wildfly.

the class WeldPortableExtensionProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    // for war modules we require a beans.xml to load portable extensions
    if (PrivateSubDeploymentMarker.isPrivate(deploymentUnit)) {
        if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
            return;
        }
    } else {
        // even if this one does not.
        if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
            return;
        }
    }
    WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(deploymentUnit);
    final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
    ClassLoader oldCl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
    try {
        WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
        loadAttachments(module, deploymentUnit, extensions);
    } finally {
        WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldCl);
    }
}
Also used : WeldPortableExtensions(org.jboss.as.weld.deployment.WeldPortableExtensions) Module(org.jboss.modules.Module) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 3 with WeldPortableExtensions

use of org.jboss.as.weld.deployment.WeldPortableExtensions in project wildfly by wildfly.

the class JSFCdiExtensionDeploymentProcessor method deploy.

public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
    if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
        WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(parent);
        extensions.registerExtensionInstance(new JSFPassivatingViewScopedCdiExtension(), parent);
    }
}
Also used : WeldPortableExtensions(org.jboss.as.weld.deployment.WeldPortableExtensions) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 4 with WeldPortableExtensions

use of org.jboss.as.weld.deployment.WeldPortableExtensions in project wildfly by wildfly.

the class CDIDeploymentProcessor method deploy.

public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
    PropertyReplacer propertyReplacer = EJBAnnotationPropertyReplacement.propertyReplacer(deploymentUnit);
    if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
        WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(parent);
        extensions.registerExtensionInstance(new JMSCDIExtension(propertyReplacer), parent);
    }
}
Also used : WeldPortableExtensions(org.jboss.as.weld.deployment.WeldPortableExtensions) PropertyReplacer(org.jboss.metadata.property.PropertyReplacer) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Aggregations

WeldPortableExtensions (org.jboss.as.weld.deployment.WeldPortableExtensions)4 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)3 BeanManagerAfterDeploymentValidation (org.jboss.as.jpa.beanmanager.BeanManagerAfterDeploymentValidation)1 PropertyReplacer (org.jboss.metadata.property.PropertyReplacer)1 Module (org.jboss.modules.Module)1