Index: lams_admin/conf/xdoclet/struts-message-resources.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/xdoclet/struts-message-resources.xml,v
diff -u -r1.1 -r1.2
--- lams_admin/conf/xdoclet/struts-message-resources.xml 10 Feb 2005 03:52:32 -0000 1.1
+++ lams_admin/conf/xdoclet/struts-message-resources.xml 4 Nov 2005 06:04:35 -0000 1.2
@@ -1,2 +1 @@
-
-
+
Index: lams_admin/conf/xdoclet/taglibs.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/xdoclet/taglibs.xml,v
diff -u -r1.1 -r1.2
--- lams_admin/conf/xdoclet/taglibs.xml 8 Sep 2005 02:45:20 -0000 1.1
+++ lams_admin/conf/xdoclet/taglibs.xml 4 Nov 2005 06:04:35 -0000 1.2
@@ -51,22 +51,22 @@
http://java.sun.com/jstl/fmt
- /WEB-INF/JSTL/tlds/fmt.tld
+ /WEB-INF/jstl/tlds/fmt.tld
http://java.sun.com/jstl/fmt-rt
- /WEB-INF/JSTL/tlds/fmt-rt.tld
+ /WEB-INF/jstl/tlds/fmt-rt.tld
http://java.sun.com/jstl/core
- /WEB-INF/JSTL/tlds/c.tld
+ /WEB-INF/jstl/tlds/c.tld
http://java.sun.com/jstl/core-rt
- /WEB-INF/JSTL/tlds/c-rt.tld
+ /WEB-INF/jstl/tlds/c-rt.tld
Index: lams_admin/src/java/org/lamsfoundation/lams/admin/applicationResources.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/Attic/applicationResources.properties,v
diff -u -r1.1 -r1.2
--- lams_admin/src/java/org/lamsfoundation/lams/admin/applicationResources.properties 10 Feb 2005 03:52:32 -0000 1.1
+++ lams_admin/src/java/org/lamsfoundation/lams/admin/applicationResources.properties 4 Nov 2005 06:04:35 -0000 1.2
@@ -5,4 +5,12 @@
#=========================Error Messages===========================#
error.authorisation=You are not authorised to do this.
error.newpassword.mismatch=Your new passwords don't match each other.
-error.oldpassword.mismatch=Your old password is not correct.
\ No newline at end of file
+error.oldpassword.mismatch=Your old password is not correct.
+
+#===================== Cache Screen ==============================#
+cache.title=Cache Management
+cache.entries.title=Cache Nodes
+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.button.remove=Remove
Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheAction.java 4 Nov 2005 06:04:35 -0000 1.1
@@ -0,0 +1,131 @@
+package org.lamsfoundation.lams.admin.web;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.lamsfoundation.lams.cache.CacheManager;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.action.LamsDispatchAction;
+import org.lamsfoundation.lams.web.util.HttpSessionManager;
+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.
+ *
+ * @struts:action name="CacheActionForm"
+ * path="/cache"
+ * parameter="method"
+ * validate="false"
+ * @struts:action-forward name="cache" path="/cache.jsp"
+ *
+ */
+public class CacheAction extends LamsDispatchAction {
+
+ public static final String CACHE_ENTRIES = "cache";
+ public static final String NODE_KEY = "node";
+
+ private static Logger log = Logger.getLogger(CacheAction.class);
+ private static WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(HttpSessionManager.getInstance().getServletContext());
+ private static CacheManager manager = (CacheManager) ctx.getBean("cacheManager");
+ //private static UserManagementService service = (UserManagementService) ctx.getBean("userManagementServiceTarget");
+
+ /*
+ private boolean isUserInRole(String login,int orgId, String roleName)
+ {
+ if (service.getUserOrganisationRole(login, new Integer(orgId),roleName)==null)
+ return false;
+ return true;
+ } */
+
+ /**
+ * request for sysadmin environment
+ */
+ public ActionForward unspecified(ActionMapping mapping, ActionForm form,
+ HttpServletRequest req, HttpServletResponse res)
+ throws IOException, ServletException {
+
+ try {
+
+ 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.");
+ /*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");
+ }
+ else
+ {
+ log.error("User "+login+" tried to get cache admin screen but isn't admin in organisation: "+orgId);
+ return mapping.findForward("error");
+ } */
+
+ Map items = manager.getCachedItems();
+ req.setAttribute(CACHE_ENTRIES, items);
+ return mapping.findForward("cache");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return mapping.findForward("error");
+ }
+ }
+
+ /**
+ * request for sysadmin environment
+ */
+ public ActionForward remove(ActionMapping mapping, ActionForm form,
+ HttpServletRequest req, HttpServletResponse res)
+ 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");
+ }
+ 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, false);
+ manager.clearCache(node);
+
+ Map items = manager.getCachedItems();
+ req.setAttribute(CACHE_ENTRIES, items);
+ return mapping.findForward("cache");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return mapping.findForward("error");
+ }
+ }
+}
\ No newline at end of file
Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheActionForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheActionForm.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/CacheActionForm.java 4 Nov 2005 06:04:35 -0000 1.1
@@ -0,0 +1,43 @@
+package org.lamsfoundation.lams.admin.web;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * @author fmalikoff
+ *
+ * @struts:form name="CacheActionForm"
+ */
+public class CacheActionForm extends ActionForm {
+
+ public static final String formName = "CacheActionForm"; // must match name in @struts:action section above
+
+ private String node;
+
+ public CacheActionForm() {
+ }
+
+
+ /**
+ * Reset all properties to their default values.
+ *
+ * @param mapping The mapping used to select this instance
+ * @param request The servlet request we are processing
+ */
+ public void reset(ActionMapping mapping, HttpServletRequest request) {
+ setNode(null);
+ }
+
+
+ public String getNode() {
+ return node;
+ }
+
+
+ public void setNode(String node) {
+ this.node = node;
+ }
+
+}
\ No newline at end of file
Index: lams_admin/web/cache.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/web/cache.jsp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/web/cache.jsp 4 Nov 2005 06:04:35 -0000 1.1
@@ -0,0 +1,47 @@
+<%@ taglib uri="tags-c" prefix="c" %>
+<%@ taglib uri="tags-html" prefix="html" %>
+<%@ taglib uri="tags-bean" prefix="bean" %>
+
+<%
+String protocol = request.getProtocol();
+if(protocol.startsWith("HTTPS")){
+ protocol = "https://";
+}else{
+ protocol = "http://";
+}
+String pathToRoot = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
+String pathToShare = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/..";
+%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+- ">
+Children:
+
+
+
+
+
+
+
+
Index: lams_admin/web/WEB-INF/web.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/web/WEB-INF/Attic/web.xml,v
diff -u -r1.3 -r1.4
--- lams_admin/web/WEB-INF/web.xml 8 Sep 2005 02:45:20 -0000 1.3
+++ lams_admin/web/WEB-INF/web.xml 4 Nov 2005 06:04:35 -0000 1.4
@@ -139,22 +139,22 @@
http://java.sun.com/jstl/fmt
- /WEB-INF/JSTL/tlds/fmt.tld
+ /WEB-INF/jstl/tlds/fmt.tld
http://java.sun.com/jstl/fmt-rt
- /WEB-INF/JSTL/tlds/fmt-rt.tld
+ /WEB-INF/jstl/tlds/fmt-rt.tld
http://java.sun.com/jstl/core
- /WEB-INF/JSTL/tlds/c.tld
+ /WEB-INF/jstl/tlds/c.tld
http://java.sun.com/jstl/core-rt
- /WEB-INF/JSTL/tlds/c-rt.tld
+ /WEB-INF/jstl/tlds/c-rt.tld
Index: lams_admin/web/WEB-INF/struts/struts-config.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/web/WEB-INF/struts/Attic/struts-config.xml,v
diff -u -r1.2 -r1.3
--- lams_admin/web/WEB-INF/struts/struts-config.xml 7 Sep 2005 06:07:11 -0000 1.2
+++ lams_admin/web/WEB-INF/struts/struts-config.xml 4 Nov 2005 06:04:35 -0000 1.3
@@ -22,6 +22,10 @@
type="org.lamsfoundation.lams.admin.web.UsersRemoveActionForm"
/>
+
@@ -148,6 +152,21 @@
/>
+
+
+
-
+