CacheModelConfig(SqlMapConfiguration config, String id, CacheController controller, boolean readOnly, boolean serialize) { this.errorContext = config.getErrorContext(); this.cacheModel = new CacheModel(); SqlMapClientImpl client = config.getClient(); errorContext.setActivity("building a cache model"); cacheModel.setReadOnly(readOnly); cacheModel.setSerialize(serialize); errorContext.setObjectId(id + " cache model"); errorContext.setMoreInfo("Check the cache model type."); cacheModel.setId(id); cacheModel.setResource(errorContext.getResource()); try { cacheModel.setCacheController(controller); } catch (Exception e) { throw new RuntimeException("Error setting Cache Controller Class. Cause: " + e, e); } errorContext.setMoreInfo("Check the cache model configuration."); if (client.getDelegate().isCacheModelsEnabled()) { client.getDelegate().addCacheModel(cacheModel); } errorContext.setMoreInfo(null); errorContext.setObjectId(null); }
CacheModelConfig(SqlMapConfiguration config, String id, CacheController controller, boolean readOnly, boolean serialize) { this.errorContext = config.getErrorContext(); this.cacheModel = new CacheModel(); SqlMapClientImpl client = config.getClient(); errorContext.setActivity("building a cache model"); cacheModel.setReadOnly(readOnly); cacheModel.setSerialize(serialize); errorContext.setObjectId(id + " cache model"); errorContext.setMoreInfo("Check the cache model type."); cacheModel.setId(id); cacheModel.setResource(errorContext.getResource()); try { cacheModel.setCacheController(controller); } catch (Exception e) { throw new RuntimeException("Error setting Cache Controller Class. Cause: " + e, e); } errorContext.setMoreInfo("Check the cache model configuration."); if (client.getDelegate().isCacheModelsEnabled()) { client.getDelegate().addCacheModel(cacheModel); } errorContext.setMoreInfo(null); errorContext.setObjectId(null); }