01: /*
02: * Created on Jan 28, 2004
03: *
04: * To change the template for this generated file go to
05: * Window - Preferences - Java - Code Generation - Code and Comments
06: */
07: package org.vfny.geoserver.action;
08:
09: import com.sun.media.jai.util.SunTileCache;
10: import org.apache.struts.action.ActionForm;
11: import org.apache.struts.action.ActionForward;
12: import org.apache.struts.action.ActionMapping;
13: import org.vfny.geoserver.global.GeoServer;
14: import org.vfny.geoserver.global.UserContainer;
15: import javax.media.jai.JAI;
16: import javax.servlet.ServletContext;
17: import javax.servlet.http.HttpServletRequest;
18: import javax.servlet.http.HttpServletResponse;
19:
20: /**
21: * Admin Index Action.
22: * <p>
23: * DOCUMENT ME.
24: * </p>
25: * @author $Author: Alessio Fabiani $ (last modification)
26: */
27: public class AdminIndexAction extends ConfigAction {
28: /* (non-Javadoc)
29: * @see org.vfny.geoserver.action.ConfigAction#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, org.vfny.geoserver.global.UserContainer, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
30: */
31: public ActionForward execute(ActionMapping mapping,
32: ActionForm form, UserContainer user,
33: HttpServletRequest request, HttpServletResponse response)
34: throws Exception {
35: ServletContext sc = request.getSession().getServletContext();
36:
37: final JAI jaiDef = ((GeoServer) sc
38: .getAttribute(GeoServer.WEB_CONTAINER_KEY))
39: .getJAIDefault();
40: final SunTileCache jaiCache = ((GeoServer) sc
41: .getAttribute(GeoServer.WEB_CONTAINER_KEY))
42: .getJaiCache();
43: final long memCapacity = jaiCache.getMemoryCapacity() / 1024;
44: final long memUsed = jaiCache.getCacheMemoryUsed() / 1024;
45: final float memThreshold = jaiCache.getMemoryThreshold() * 100;
46: final int numThreads = jaiDef.getTileScheduler()
47: .getParallelism();
48: final int priiority = jaiDef.getTileScheduler().getPriority();
49:
50: request.setAttribute("JAI_MEM_CAPACITY", new Long(memCapacity));
51: request.setAttribute("JAI_MEM_USED", new Long(memUsed));
52: request.setAttribute("JAI_MEM_THRESHOLD", new Float(
53: memThreshold));
54: request.setAttribute("JAI_TILE_THREADS",
55: new Integer(numThreads));
56: request.setAttribute("JAI_TILE_PRIORITY",
57: new Integer(priiority));
58:
59: // return back to the admin screen
60: //
61: return mapping.findForward("admin.main");
62: }
63: }
|