String level2ClassName = getOMFContext().getPluginManager().getAttributeValueForExtension("org.jpox.cache_level2",
"name", level2Type, "class-name");
if (level2ClassName == null)
{
// Plugin of this name not found
throw new JPOXUserException(LOCALISER.msg("004000", level2Type)).setFatal();
}
try
{
// Create an instance of the L2 Cache
Class level2CacheClass = Class.forName(level2ClassName);
Class[] ctrArgsClasses = new Class[] {OMFContext.class};
Object[] ctrArgs = new Object[] {omfContext};
Constructor ctr = level2CacheClass.getConstructor(ctrArgsClasses);
cache = (Level2Cache)ctr.newInstance(ctrArgs);
if (JPOXLogger.CACHE.isDebugEnabled())
{
JPOXLogger.CACHE.debug(LOCALISER.msg("004002", level2ClassName));
}
}
catch (Exception e)
{
// Class name for this L2 cache plugin is not found!
throw new JPOXUserException(LOCALISER.msg("004001", level2Type, level2ClassName), e).setFatal();
}
}
else
{
cache = new NullLevel2Cache();