package org.theonefx.wcframework.cache;
import org.theonefx.wcframework.aop.AopCore;
import org.theonefx.wcframework.core.ModuleLoader;
import org.theonefx.wcframework.core.ObjectRegistry;
import org.theonefx.wcframework.core.XmlParserRegister;
import org.theonefx.wcframework.core.exception.InitialException;
import org.theonefx.wcframework.ioc.BeanFactory;
import org.theonefx.wcframework.ioc.BeanPostProcessorRegister;
import org.theonefx.wcframework.ioc.ClassParserRegister;
public class CacheModuleLoader implements ModuleLoader {
@Override
public void loadModule(XmlParserRegister xmlReg, ClassParserRegister classReg, BeanPostProcessorRegister beanProcessReg, ObjectRegistry objectRegistry, BeanFactory factory) {
AopCore aopCore = (AopCore) objectRegistry.getObject(AopCore.AOPMODULE_GATEWAY_OBJECT);
if (aopCore == null) {
throw new InitialException("无法初始化Cache模块,由于没有检测到AOP模块入口");
}
MethodCacheManager cacheManager = new MethodCacheManager();
classReg.regist(new CacheClassParser(aopCore, cacheManager));
}
}