Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r1331b40e2fbc07867d59bcff24d0223d38ee7d5b -r4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 1331b40e2fbc07867d59bcff24d0223d38ee7d5b) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f) @@ -172,10 +172,15 @@ cache.maintain =Maintain LAMS Cache cache.title =Cache Management cache.entries.title =Cache Nodes +cache.entries.title2 =Cacheable entities cache.explanation1 =Listed below are the current nodes in the cache. This keeps certain common objects in memory to speed up LAMS. It is managed automatically and should not require any intervention. However, if the system appears to be keeping "old values" e.g. an old first name, try clearing all the nodes in the cache. Once cleared, LAMS will reload the objects from the database. cache.explanation2 =Warning: Removing nodes will reduce the performance of the LAMS server. After a while, the cache will build up again and LAMS will run as usual. cache.explanation3 =Warning: If you remove a node, you will remove the node and all its child nodes. +cache.explanation4 =Listed below are cacheable classes and collections. This keeps certain common objects in memory to speed up LAMS. It is managed automatically and should not require any intervention. However, if the system appears to be keeping "old values" e.g. an old first name, try clearing all the nodes in the cache. Once cleared, LAMS will reload the objects from the database. cache.button.remove =Remove +cache.button.remove.all =Clear all cached objects +cache.removed =Objects bound with entity name {0} were removed +cache.removed.all =All cached objects were removed admin.config.key =Key admin.config.value =Value admin.register.sitename =Full Sitename Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheAction.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheAction.java (.../CacheAction.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheAction.java (.../CacheAction.java) (revision 4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f) @@ -25,6 +25,7 @@ import java.io.IOException; import java.util.Map; +import java.util.Set; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -35,15 +36,16 @@ import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.cache.CacheManager; +import org.lamsfoundation.lams.cache.ICacheManager; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; /** - * this is an action where all lams client environments launch. - * initial configuration of the individual environment setting is done here. + * This is an action where all lams client environments launch. + * Initial configuration of the individual environment setting is done here. * * @struts:action name="CacheActionForm" * path="/cache" @@ -58,7 +60,7 @@ public static final String NODE_KEY = "node"; private static Logger log = Logger.getLogger(CacheAction.class); - private static CacheManager manager; + private static ICacheManager cacheManager; /** * request for sysadmin environment */ @@ -67,11 +69,12 @@ throws IOException, ServletException { try { + if (log.isDebugEnabled()) { + log.debug("Cache lookup"); + } - log.debug("cache lookup"); - // todo restrict access to admin only. Can't do at present as don't know orgID - log.error("CacheAction should be restricted to admin only. No check being done. Please implement."); + log.warn("CacheAction should be restricted to admin only. No check being done. Please implement."); /*String login = req.getRemoteUser(); int orgId = new Integer(req.getParameter("orgId")).intValue(); @@ -88,7 +91,7 @@ return mapping.findForward("error"); } */ - Map items = getManager().getCachedItems(); + Set items = getCacheManager().getCachedClasses(); req.setAttribute(CACHE_ENTRIES, items); return mapping.findForward("cache"); @@ -106,46 +109,34 @@ throws IOException, ServletException { try { - - log.debug("remove"); - - // todo restrict access to admin only. Can't do at present as don't know orgID - log.error("CacheAction should be restricted to admin only. No check being done. Please implement."); - /*String login = req.getRemoteUser(); - int orgId = new Integer(req.getParameter("orgId")).intValue(); - - if ( isUserInRole(login,orgId,Role.ADMIN)) - { - log.debug("user is admin"); - Organisation org = service.getOrganisationById(new Integer(orgId)); - AdminPreparer.prepare(org,req,service); - return mapping.findForward("admin"); + // todo restrict access to admin only. Can't do at present as don't know orgID + + if (log.isDebugEnabled()) { + log.debug("Remove entity from cache"); } - else - { - log.error("User "+login+" tried to get cache admin screen but isn't admin in organisation: "+orgId); - return mapping.findForward("error"); - } */ + String node = WebUtil.readStrParam(req, NODE_KEY); - String node = WebUtil.readStrParam(req, NODE_KEY, false); - getManager().clearCache(node); + // if node = ALL, remove all cache + getCacheManager().clearCachedClass(node.equalsIgnoreCase("ALL") ? null : node); - Map items = getManager().getCachedItems(); - req.setAttribute(CACHE_ENTRIES, items); - return mapping.findForward("cache"); + // so we know what entity has been removed + req.setAttribute(NODE_KEY, node); + // display the list again + return unspecified(mapping,form,req,res); + } catch (Exception e) { e.printStackTrace(); return mapping.findForward("error"); } } - private CacheManager getManager(){ - if(manager==null){ + private ICacheManager getCacheManager(){ + if(cacheManager==null){ WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext()); - manager = (CacheManager) ctx.getBean("cacheManager"); + cacheManager = (CacheManager) ctx.getBean("cacheManager"); } - return manager; + return cacheManager; } } \ No newline at end of file Index: lams_admin/web/cache.jsp =================================================================== diff -u -r7ab9e2377fd1ff4c3c5554bd1f6dffe3384f6f9a -r4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f --- lams_admin/web/cache.jsp (.../cache.jsp) (revision 7ab9e2377fd1ff4c3c5554bd1f6dffe3384f6f9a) +++ lams_admin/web/cache.jsp (.../cache.jsp) (revision 4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f) @@ -5,23 +5,36 @@


-

+

-

- - + +
+ + + + + + + ${node} + + + +
+
-

+ -

Index: lams_build/build.xml =================================================================== diff -u -r5e3b4e2d6f952452130e01c1ca9e62d4df97fa0c -r4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f --- lams_build/build.xml (.../build.xml) (revision 5e3b4e2d6f952452130e01c1ca9e62d4df97fa0c) +++ lams_build/build.xml (.../build.xml) (revision 4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f) @@ -489,9 +489,6 @@ - Fisheye: Tag 4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f refers to a dead (removed) revision in file `lams_build/conf/unix/jboss/service/lams-cache-jboss-beans.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f refers to a dead (removed) revision in file `lams_build/conf/windows/jboss/service/lams-cache-jboss-beans.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_common/src/java/org/lamsfoundation/lams/applicationContext.xml =================================================================== diff -u -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 -r4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f --- lams_common/src/java/org/lamsfoundation/lams/applicationContext.xml (.../applicationContext.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) +++ lams_common/src/java/org/lamsfoundation/lams/applicationContext.xml (.../applicationContext.xml) (revision 4f40b2a39d2e2a4fcaeebe3568eb91858732fb8f) @@ -26,8 +26,8 @@ jboss.cache:service=TreeCache +