// cache connections
Element[] eConnections = getChildren(eCache, "connection");
// if(hasAccess) {
String name, clazzName;
CacheConnection cc;
Class cacheClazz;
// caches
if (hasAccess)
for (int i = 0; i < eConnections.length; i++) {
Element eConnection = eConnections[i];
name = eConnection.getAttribute("name");
clazzName = eConnection.getAttribute("class");
if (clazzName != null)
clazzName = clazzName.trim();
//
try {
// Workaround for old EHCacheLite class defintion
if ("railo.extension.io.cache.eh.EHCacheLite".equals(clazzName))
cacheClazz = EHCacheLite.class;
else
cacheClazz = ClassUtil.loadClass(config.getClassLoader(), clazzName);
cc = new CacheConnectionImpl(config, name, cacheClazz, toStruct(eConnection.getAttribute("custom")), Caster.toBooleanValue(
eConnection.getAttribute("read-only"), false), Caster.toBooleanValue(eConnection.getAttribute("storage"), false));
if (!StringUtil.isEmpty(name)) {
caches.put(name.toLowerCase(), cc);
}
else
SystemOut.print(config.getErrWriter(), "missing cache name");
}
catch (ClassException ce) {
SystemOut.print(config.getErrWriter(), ExceptionUtil.getStacktrace(ce, true));
}
catch (IOException e) {
SystemOut.print(config.getErrWriter(), ExceptionUtil.getStacktrace(e, true));
}
}
// }
// call static init once per driver
{
// group by classes
Map _caches = new HashMap();
Iterator it = caches.entrySet().iterator();
Map.Entry entry;
ArrayList list;
while (it.hasNext()) {
entry = (Entry) it.next();
cc = (CacheConnection) entry.getValue();
list = (ArrayList) _caches.get(cc.getClazz());
if (list == null) {
list = new ArrayList();
_caches.put(cc.getClazz(), list);
}
list.add(cc);
}
// call