/** * Creation of a new file based cache controller using a supplied configuration model and cache * layout resolver. * * @param model the cache system confiuguration model */ public DefaultCacheHandler(CacheModel model, Logger logger) throws IOException { super(); m_model = model; m_logger = logger; m_zipCache = new ZipCache(); m_resourceHosts = new TreeMap(); LayoutRegistryModel layoutModel = model.getLayoutRegistryModel(); m_registry = new DefaultLayoutRegistry(layoutModel, logger); LayoutModel layout = model.getLayoutModel(); try { String key = layout.getID(); m_resolver = m_registry.getLayout(key); } catch (Throwable e) { final String error = "Cannot construct cache handler due to a cache layout resolvution failure."; throw new TransitException(error, e); } if (getLogger().isTraceEnabled()) { getLogger().trace("cache initialization"); } // // For all of the declared host models we check for hosts that do not // declare a plugin uri. If no plugin uri is declared we are dealing with // a classic resource host that serves as a bootstrap host. Leter on the // SecuredTransitContext will initialize this instance and we will continue // with host loading for plugin based resource hosts. // HostModel[] hosts = model.getHostModels(); if (getLogger().isTraceEnabled()) { getLogger().trace("host count: " + hosts.length); } for (int i = 0; i < hosts.length; i++) { HostModel host = hosts[i]; String id = host.getID(); ResourceHost handler = createDefaultResourceHost(host); m_resourceHosts.put(id, handler); } // // setup the cache directory // File cache = model.getCacheDirectory(); setLocalCacheDirectory(cache); if (getLogger().isTraceEnabled()) { getLogger().trace("bootstrap initialization complete"); } }