@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);
// @DataSourceDefinitions
List<AnnotationInstance> datasourceDefinitions = index.getAnnotations(DATASOURCE_DEFINITIONS);
if (datasourceDefinitions != null) {
for (AnnotationInstance annotation : datasourceDefinitions) {
final AnnotationTarget target = annotation.target();
if (target instanceof ClassInfo == false) {
throw new DeploymentUnitProcessingException("@DataSourceDefinitions can only be applied " +
"on class. " + target + " is not a class");
}
// get the nested @DataSourceDefinition out of the outer @DataSourceDefinitions
List<AnnotationInstance> datasources = this.getNestedDataSourceAnnotations(annotation);
// process the nested @DataSourceDefinition
for (AnnotationInstance datasource : datasources) {
// create binding configurations out of it
this.processDataSourceDefinition(eeModuleDescription, datasource, (ClassInfo) target, applicationClasses);
}
}
}
// @DataSourceDefinition
List<AnnotationInstance> datasources = index.getAnnotations(DATASOURCE_DEFINITION);
if (datasources != null) {
for (AnnotationInstance datasource : datasources) {
final AnnotationTarget target = datasource.target();
if (target instanceof ClassInfo == false) {
throw new DeploymentUnitProcessingException("@DataSourceDefinition can only be applied " +