use of org.jboss.as.ejb3.cache.CacheInfo in project wildfly by wildfly.
the class CacheMergingProcessor method handleDeploymentDescriptor.
@Override
protected void handleDeploymentDescriptor(DeploymentUnit deploymentUnit, DeploymentReflectionIndex deploymentReflectionIndex, Class<?> componentClass, StatefulComponentDescription description) throws DeploymentUnitProcessingException {
final String ejbName = description.getEJBName();
final EjbJarMetaData metaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
if (metaData == null) {
return;
}
final AssemblyDescriptorMetaData assemblyDescriptor = metaData.getAssemblyDescriptor();
if (assemblyDescriptor == null) {
return;
}
// get the pool metadata
final List<EJBBoundCacheMetaData> caches = assemblyDescriptor.getAny(EJBBoundCacheMetaData.class);
String cacheName = null;
if (caches != null) {
for (final EJBBoundCacheMetaData cacheMetaData : caches) {
// for the specific bean (i.e. via an ejb-name match)
if ("*".equals(cacheMetaData.getEjbName()) && cacheName == null) {
cacheName = cacheMetaData.getCacheName();
} else if (ejbName.equals(cacheMetaData.getEjbName())) {
cacheName = cacheMetaData.getCacheName();
}
}
}
if (cacheName != null) {
description.setCache(new CacheInfo(cacheName));
}
}
use of org.jboss.as.ejb3.cache.CacheInfo in project wildfly by wildfly.
the class CacheMergingProcessor method handleAnnotations.
@Override
protected void handleAnnotations(DeploymentUnit deploymentUnit, EEApplicationClasses applicationClasses, DeploymentReflectionIndex deploymentReflectionIndex, Class<?> componentClass, StatefulComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
final EEModuleClassDescription clazz = applicationClasses.getClassByName(componentClass.getName());
//we only care about annotations on the bean class itself
if (clazz == null) {
return;
}
final ClassAnnotationInformation<Cache, CacheInfo> cache = clazz.getAnnotationInformation(Cache.class);
if (cache == null) {
return;
}
if (!cache.getClassLevelAnnotations().isEmpty()) {
componentConfiguration.setCache(cache.getClassLevelAnnotations().get(0));
}
}
Aggregations