Search in sources :

Example 51 with CompositeIndex

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

the class ResourceLookupDependenciesProvider method getDependencies.

@Override
public Set<ServiceName> getDependencies(DeploymentUnit unit) {
    CompositeIndex index = unit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
    PropertyReplacer replacer = EJBAnnotationPropertyReplacement.propertyReplacer(unit);
    List<AnnotationInstance> annotations = index.getAnnotations(RESOURCE_ANNOTATION_NAME);
    Set<ServiceName> result = !annotations.isEmpty() ? new TreeSet<>() : Collections.emptySet();
    for (AnnotationInstance annotation : annotations) {
        AnnotationValue lookupValue = annotation.value("lookup");
        if (lookupValue != null) {
            String lookup = replacer.replaceProperties(lookupValue.asString());
            try {
                ServiceName name = ContextNames.bindInfoFor(lookup).getBinderServiceName();
                if (ContextNames.JBOSS_CONTEXT_SERVICE_NAME.isParentOf(name)) {
                    result.add(name);
                }
            } catch (RuntimeException e) {
            // No associated naming store
            }
        }
    }
    return result;
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) CompositeIndex(org.jboss.as.server.deployment.annotation.CompositeIndex) AnnotationValue(org.jboss.jandex.AnnotationValue) PropertyReplacer(org.jboss.metadata.property.PropertyReplacer) AnnotationInstance(org.jboss.jandex.AnnotationInstance)

Example 52 with CompositeIndex

use of org.jboss.as.server.deployment.annotation.CompositeIndex 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)

Example 53 with CompositeIndex

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

the class XTSDependenciesDeploymentProcessor 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) || isTransactionalEndpointPresent(compositeIndex)) {
        addXTSModuleDependency(unit);
    }
}
Also used : CompositeIndex(org.jboss.as.server.deployment.annotation.CompositeIndex) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Aggregations

CompositeIndex (org.jboss.as.server.deployment.annotation.CompositeIndex)53 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)37 AnnotationInstance (org.jboss.jandex.AnnotationInstance)23 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)20 ClassInfo (org.jboss.jandex.ClassInfo)17 HashSet (java.util.HashSet)11 DotName (org.jboss.jandex.DotName)10 EEApplicationClasses (org.jboss.as.ee.component.EEApplicationClasses)9 AnnotationValue (org.jboss.jandex.AnnotationValue)8 Module (org.jboss.modules.Module)8 AnnotationTarget (org.jboss.jandex.AnnotationTarget)7 HashMap (java.util.HashMap)6 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)6 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)6 WarMetaData (org.jboss.as.web.common.WarMetaData)6 PropertyReplacer (org.jboss.metadata.property.PropertyReplacer)6 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)4 ArrayList (java.util.ArrayList)3 ModuleDependency (org.jboss.as.server.deployment.module.ModuleDependency)3 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)3