use of org.jboss.as.server.deployment.annotation.CompositeIndex in project wildfly by wildfly.
the class AbstractDeploymentUnitProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
// get hold of the deployment unit
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
return;
}
final CompositeIndex compositeIndex = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
if (compositeIndex == null) {
EjbLogger.DEPLOYMENT_LOGGER.tracef("Skipping EJB annotation processing since no composite annotation index found in unit: %s", deploymentUnit);
} else {
if (MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) {
EjbLogger.DEPLOYMENT_LOGGER.trace("Skipping EJB annotation processing due to deployment being metadata-complete. ");
} else {
processAnnotations(deploymentUnit, compositeIndex);
}
}
processDeploymentDescriptor(deploymentUnit);
}
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);
}
}
use of org.jboss.as.server.deployment.annotation.CompositeIndex in project wildfly by wildfly.
the class AnnotatedEJBComponentDescriptionDeploymentUnitProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
// get hold of the deployment unit
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
return;
}
final CompositeIndex compositeIndex = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
if (compositeIndex == null) {
EjbLogger.DEPLOYMENT_LOGGER.tracef("Skipping Jakarta Enterprise Beans annotation processing since no composite annotation index found in unit: %s", deploymentUnit);
} else {
if (MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) {
EjbLogger.DEPLOYMENT_LOGGER.trace("Skipping Jakarta Enterprise Beans annotation processing due to deployment being metadata-complete. ");
} else {
processAnnotations(deploymentUnit, compositeIndex);
}
}
processDeploymentDescriptor(deploymentUnit);
}
use of org.jboss.as.server.deployment.annotation.CompositeIndex in project wildfly by wildfly.
the class JPAAnnotationProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
// @PersistenceContext
List<AnnotationInstance> persistenceContexts = index.getAnnotations(PERSISTENCE_CONTEXT_ANNOTATION_NAME);
// create binding and injection configurations out of the @PersistenceContext annotations
this.processPersistenceAnnotations(deploymentUnit, eeModuleDescription, persistenceContexts, applicationClasses);
// @PersistenceContexts
List<AnnotationInstance> collectionPersistenceContexts = index.getAnnotations(PERSISTENCE_CONTEXTS_ANNOTATION_NAME);
// create binding and injection configurations out of the @PersistenceContext annotations
processPersistenceAnnotations(deploymentUnit, eeModuleDescription, collectionPersistenceContexts, applicationClasses);
// @PersistenceUnits
List<AnnotationInstance> collectionPersistenceunits = index.getAnnotations(PERSISTENCE_UNITS_ANNOTATION_NAME);
processPersistenceAnnotations(deploymentUnit, eeModuleDescription, collectionPersistenceunits, applicationClasses);
// @PersistenceUnit
List<AnnotationInstance> persistenceUnits = index.getAnnotations(PERSISTENCE_UNIT_ANNOTATION_NAME);
// create binding and injection configurations out of the @PersistenceUnit annotations
this.processPersistenceAnnotations(deploymentUnit, eeModuleDescription, persistenceUnits, applicationClasses);
// if we found any @PersistenceContext or @PersistenceUnit annotations then mark this as a Jakarta Persistence deployment
if (!persistenceContexts.isEmpty() || !persistenceUnits.isEmpty() || !collectionPersistenceContexts.isEmpty() || !collectionPersistenceunits.isEmpty()) {
JPADeploymentMarker.mark(deploymentUnit);
}
}
use of org.jboss.as.server.deployment.annotation.CompositeIndex in project wildfly by wildfly.
the class HibernateSearchProcessor method addSearchDependency.
private void addSearchDependency(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader, DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
String searchModuleName = null;
PersistenceUnitsInApplication persistenceUnitsInApplication = DeploymentUtils.getTopDeploymentUnit(deploymentUnit).getAttachment(PersistenceUnitsInApplication.PERSISTENCE_UNITS_IN_APPLICATION);
for (PersistenceUnitMetadataHolder holder : persistenceUnitsInApplication.getPersistenceUnitHolders()) {
for (PersistenceUnitMetadata pu : holder.getPersistenceUnits()) {
String providerModule = pu.getProperties().getProperty(Configuration.HIBERNATE_SEARCH_MODULE);
if (providerModule != null) {
// one persistence unit specifying the Hibernate search module is allowed
if (searchModuleName == null) {
searchModuleName = providerModule;
} else // more than one persistence unit specifying different Hibernate search module names is not allowed
if (!providerModule.equals(searchModuleName)) {
throw JpaLogger.ROOT_LOGGER.differentSearchModuleDependencies(deploymentUnit.getName(), searchModuleName, providerModule);
}
}
}
}
if (NONE.equals(searchModuleName)) {
// Hibernate Search module will not be added to deployment
ROOT_LOGGER.debugf("Not adding Hibernate Search dependency to deployment %s", deploymentUnit.getName());
return;
}
// use Search module name specified in persistence unit definition
if (searchModuleName != null && !IGNORE.equals(searchModuleName)) {
ModuleIdentifier moduleIdentifier = ModuleIdentifier.fromString(searchModuleName);
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, false, true, true, false));
ROOT_LOGGER.debugf("added %s dependency to %s", moduleIdentifier, deploymentUnit.getName());
} else {
// add Hibernate Search module dependency if application is using the Hibernate Search Indexed annotation
final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
List<AnnotationInstance> annotations = index.getAnnotations(SEARCH_INDEXED_ANNOTATION_NAME);
if (annotations != null && !annotations.isEmpty()) {
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, defaultSearchModule, false, true, true, false));
ROOT_LOGGER.debugf("deployment %s contains %s annotation, added %s dependency", deploymentUnit.getName(), SEARCH_INDEXED_ANNOTATION_NAME, defaultSearchModule);
}
}
}
Aggregations