Search in sources :

Example 1 with EJBBoundCacheMetaData

use of org.jboss.as.ejb3.cache.EJBBoundCacheMetaData 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));
    }
}
Also used : EJBBoundCacheMetaData(org.jboss.as.ejb3.cache.EJBBoundCacheMetaData) EjbJarMetaData(org.jboss.metadata.ejb.spec.EjbJarMetaData) AssemblyDescriptorMetaData(org.jboss.metadata.ejb.spec.AssemblyDescriptorMetaData) CacheInfo(org.jboss.as.ejb3.cache.CacheInfo)

Aggregations

CacheInfo (org.jboss.as.ejb3.cache.CacheInfo)1 EJBBoundCacheMetaData (org.jboss.as.ejb3.cache.EJBBoundCacheMetaData)1 AssemblyDescriptorMetaData (org.jboss.metadata.ejb.spec.AssemblyDescriptorMetaData)1 EjbJarMetaData (org.jboss.metadata.ejb.spec.EjbJarMetaData)1