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;
}
}
}
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) {
}
}
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);
}
}
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;
}
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);
}
}
Aggregations