Search in sources :

Example 61 with DeploymentUnit

use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.

the class JaxrsAnnotationProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (deploymentUnit.getParent() == null) {
        //register resource, provider and application as CDI annotation defining types
        deploymentUnit.addToAttachmentList(INJECTION_TARGET_DEFINING_ANNOTATIONS, JaxrsAnnotations.PROVIDER.getDotName());
        deploymentUnit.addToAttachmentList(INJECTION_TARGET_DEFINING_ANNOTATIONS, JaxrsAnnotations.PATH.getDotName());
    }
    final CompositeIndex index = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
    for (final JaxrsAnnotations annotation : JaxrsAnnotations.values()) {
        if (!index.getAnnotations(annotation.getDotName()).isEmpty()) {
            JaxrsDeploymentMarker.mark(deploymentUnit);
            phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, Services.JBOSS_MODULE_INDEX_SERVICE);
            return;
        }
    }
}
Also used : JaxrsAnnotations(org.jboss.as.jaxrs.JaxrsAnnotations) CompositeIndex(org.jboss.as.server.deployment.annotation.CompositeIndex) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 62 with DeploymentUnit

use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.

the class JaxrsCdiIntegrationProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
    if (!JaxrsDeploymentMarker.isJaxrsDeployment(deploymentUnit)) {
        return;
    }
    if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
        return;
    }
    final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
    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);
        }
    } catch (ClassNotFoundException ignored) {
    }
}
Also used : JBossWebMetaData(org.jboss.metadata.web.jboss.JBossWebMetaData) WarMetaData(org.jboss.as.web.common.WarMetaData) Module(org.jboss.modules.Module) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 63 with DeploymentUnit

use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.

the class JaxrsDependencyProcessor method deploy.

public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    addDependency(moduleSpecification, moduleLoader, JAXRS_API, false);
    addDependency(moduleSpecification, moduleLoader, JAXB_API, false);
    addDependency(moduleSpecification, moduleLoader, JSON_API, false);
    //we need to add these from all deployments, as they could be using the JAX-RS client
    addDependency(moduleSpecification, moduleLoader, RESTEASY_ATOM, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_VALIDATOR_11, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JAXRS, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JAXB, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JACKSON2, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JSON_P_PROVIDER, true);
    //addDependency(moduleSpecification, moduleLoader, RESTEASY_JETTISON);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JSAPI, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_MULTIPART, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_YAML, true);
    addDependency(moduleSpecification, moduleLoader, JACKSON_CORE_ASL, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_CRYPTO, true);
    addDependency(moduleSpecification, moduleLoader, JACKSON_DATATYPE_JDK8, true);
    addDependency(moduleSpecification, moduleLoader, JACKSON_DATATYPE_JSR310, true);
    if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
        addDependency(moduleSpecification, moduleLoader, RESTEASY_CDI, true);
    }
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 64 with DeploymentUnit

use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.

the class JaxrsDeploymentMarker method isJaxrsDeployment.

public static boolean isJaxrsDeployment(DeploymentUnit deploymentUnit) {
    DeploymentUnit deployment = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
    Boolean val = deployment.getAttachment(ATTACHMENT_KEY);
    return val != null && val;
}
Also used : DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 65 with DeploymentUnit

use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.

the class CompensationsDependenciesDeploymentProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    final CompositeIndex compositeIndex = unit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
    if (compositeIndex == null) {
        return;
    }
    if (isCompensationAnnotationPresent(compositeIndex)) {
        addCompensationsModuleDependency(unit);
    }
}
Also used : CompositeIndex(org.jboss.as.server.deployment.annotation.CompositeIndex) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Aggregations

DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)271 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)77 Module (org.jboss.modules.Module)58 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)49 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)44 ServiceName (org.jboss.msc.service.ServiceName)44 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)43 ArrayList (java.util.ArrayList)33 ModuleSpecification (org.jboss.as.server.deployment.module.ModuleSpecification)32 VirtualFile (org.jboss.vfs.VirtualFile)30 CompositeIndex (org.jboss.as.server.deployment.annotation.CompositeIndex)29 WarMetaData (org.jboss.as.web.common.WarMetaData)25 ServiceTarget (org.jboss.msc.service.ServiceTarget)25 HashMap (java.util.HashMap)24 HashSet (java.util.HashSet)24 ModuleDependency (org.jboss.as.server.deployment.module.ModuleDependency)24 ModuleLoader (org.jboss.modules.ModuleLoader)24 DeploymentReflectionIndex (org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex)20 EEApplicationClasses (org.jboss.as.ee.component.EEApplicationClasses)19 EJBComponentDescription (org.jboss.as.ejb3.component.EJBComponentDescription)17