<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %> <%@ page import=" org.opencms.i18n.*, org.opencms.cache.*, org.opencms.flex.*, org.opencms.main.*, org.opencms.workplace.CmsDialog, org.opencms.jsp.CmsJspActionElement, java.util.*" %> <% CmsJspActionElement jsp = new CmsJspActionElement(pageContext, request, response); CmsDialog wp = new CmsDialog(jsp); %> <%= wp.htmlStart("administration/index.html") %> <%= wp.bodyStart(null) %> <%= wp.dialogStart() %> <%= wp.dialogContentStart(wp.key("flexcache.admin.heading")) %> <% int sizeEntries = 0; int sizeKeys = 0; CmsFlexCache cache = null; org.opencms.file.CmsObject cms = null; int maxCacheByteSize = 0; int avgCacheByteSize = 0; int currentCacheByteSize = 0; int currentCacheObjectCount = 0; CmsLruCache entryLruCache = null; out = pageContext.getOut(); String locale = "en"; CmsFlexController controller = (CmsFlexController)request.getAttribute(CmsFlexController.ATTRIBUTE_NAME); cache = controller.getCmsCache(); cms = wp.getCms(); // get the label texts for the submit buttons String label_1 = wp.key("flexcache.admin.label1"); String label_2 = wp.key("flexcache.admin.label2"); String label_5 = wp.key("flexcache.admin.label5"); String label_6 = wp.key("flexcache.admin.label6"); String label_7 = wp.key("flexcache.admin.label7"); String label_8 = wp.key("flexcache.admin.label8"); String label_9 = wp.key("flexcache.admin.label9"); String label_3 = wp.key("flexcache.admin.label3"); String label_4 = wp.key("flexcache.admin.label4"); String label_10 = wp.key("flexcache.admin.label10"); String action = CmsEncoder.decode(request.getParameter("action")); if (action != null) { if (label_1.equals(action)) { OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR, Collections.singletonMap("action", new Integer(CmsFlexCache.CLEAR_ENTRIES)))); } else if (label_2.equals(action)) { OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR, Collections.singletonMap("action", new Integer(CmsFlexCache.CLEAR_ALL)))); } else if (label_6.equals(action)) { OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR, Collections.singletonMap("action", new Integer(CmsFlexCache.CLEAR_ONLINE_ALL)))); } else if (label_5.equals(action)) { OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR, Collections.singletonMap("action", new Integer(CmsFlexCache.CLEAR_ONLINE_ENTRIES)))); } else if (label_8.equals(action)) { OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR, Collections.singletonMap("action", new Integer(CmsFlexCache.CLEAR_OFFLINE_ALL)))); } else if (label_7.equals(action)) { OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR, Collections.singletonMap("action", new Integer(CmsFlexCache.CLEAR_OFFLINE_ENTRIES)))); } else if (label_9.equals(action)) { OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, new HashMap(0))); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR, Collections.singletonMap("action", new Integer(CmsFlexCache.CLEAR_ENTRIES)))); } } if (cache != null) { sizeEntries = cache.size(); sizeKeys = cache.keySize(); entryLruCache = cache.getEntryLruCache(); if (entryLruCache!=null) { maxCacheByteSize = entryLruCache.getMaxCacheCosts(); avgCacheByteSize = entryLruCache.getAvgCacheCosts(); currentCacheByteSize = entryLruCache.getObjectCosts(); currentCacheObjectCount = entryLruCache.size(); } } %>
<%= wp.key("flexcache.admin.variants_size") %> <%=sizeEntries%>  
<%= wp.key("flexcache.admin.keys") %> <%=sizeKeys%>  
<%= wp.key("flexcache.admin.variants_maxsize") %> <%=maxCacheByteSize%> <%= wp.key("flexcache.admin.bytes") %>
<%= wp.key("flexcache.admin.variants_avgsize") %> <%=avgCacheByteSize%> <%= wp.key("flexcache.admin.bytes") %>
<%= wp.key("flexcache.admin.variants_cursize") %> <%=currentCacheByteSize%> <%= wp.key("flexcache.admin.bytes") %>

<%= wp.key("flexcache.admin.clear_options") %>

<% if (cache.cacheOffline()) { %>

<%= wp.key("flexcache.admin.clear_options2") %>

<%= wp.key("flexcache.admin.online") %> <%= wp.key("flexcache.admin.cache") %> <%= wp.key("flexcache.admin.offline") %> <%= wp.key("flexcache.admin.cache") %>
<% } %>

<%= wp.key("flexcache.admin.jsp_options") %>

<%= wp.key("flexcache.admin.cached_resources") %>

<% if ((action != null) && (cache != null)) { if (label_3.equals(action) || label_4.equals(action)) { boolean showall = false; if (label_4.equals(action)) { showall = true; out.write("

"+wp.key("flexcache.admin.cached_keys_variants")+"

"); } else { out.write("

"+wp.key("flexcache.admin.cached_keys")+"

"); } Set set = cache.getCachedResources(cms); if (cache.cacheOffline()) { List online = new ArrayList(); List offline = new ArrayList(); Iterator i = set.iterator(); while(i.hasNext()) { String resource = (String)i.next(); if (resource.endsWith(cache.CACHE_OFFLINESUFFIX)) { offline.add(resource); } else { online.add(resource); } } Collections.sort(offline); Collections.sort(online); out.write("

"+wp.key("flexcache.admin.online")+"

"); i = online.iterator(); while(i.hasNext()) { String resource = (String)i.next(); out.write(wp.key("flexcache.admin.resource")+": " + resource + "   "+wp.key("flexcache.admin.key")+": " + cache.getCachedKey(resource, cms) + "
"); if (showall) { Set variations = cache.getCachedVariations(resource, cms); if (variations.size() > 0) { List outlist = new ArrayList(); for(Iterator j = variations.iterator(); j.hasNext(); outlist.add(j.next())); Collections.sort(outlist); Iterator s = outlist.iterator(); while (s.hasNext()) { String v = (String)s.next(); out.write("        "+wp.key("flexcache.admin.variant")+": " + v + "
"); } } } } if (online.size() == 0) out.write(wp.key("flexcache.admin.err_online")); out.write("

"+wp.key("flexcache.admin.offline")+"

"); i = offline.iterator(); while(i.hasNext()) { String resource = (String)i.next(); out.write(wp.key("flexcache.admin.resource")+": " + resource + "   "+wp.key("flexcache.admin.key")+": " + cache.getCachedKey(resource, cms) + "
"); if (showall) { Set variations = cache.getCachedVariations(resource, cms); if (variations.size() > 0) { List outlist = new ArrayList(); for(Iterator j = variations.iterator(); j.hasNext(); outlist.add(j.next())); Collections.sort(outlist); Iterator s = outlist.iterator(); while (s.hasNext()) { String v = (String)s.next(); out.write("        "+wp.key("flexcache.admin.variant")+": " + v + "
"); } } } } if (offline.size() == 0) out.write(wp.key("flexcache.admin.err_offline")); } else { List online = new ArrayList(); online.addAll(set); Collections.sort(online); Iterator i = online.iterator(); while(i.hasNext()) { String resource = (String)i.next(); out.write(wp.key("flexcache.admin.resource")+": " + resource + "   "+wp.key("flexcache.admin.key")+": " + cache.getCachedKey(resource, cms) + "
"); if (showall) { Set variations = cache.getCachedVariations(resource, cms); if (variations.size() > 0) { List outlist = new ArrayList(); for(Iterator j = variations.iterator(); j.hasNext(); outlist.add(j.next())); Collections.sort(outlist); Iterator s = outlist.iterator(); while (s.hasNext()) { String v = (String)s.next(); out.write("        "+wp.key("flexcache.admin.variant")+": " + v + "
"); } } } } if (set.size() == 0) out.write(wp.key("flexcache.admin.err_empty")); } } } %> <%= wp.bodyEnd() %> <%= wp.htmlEnd() %>