1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.services;
18
19
20 import org.apache.jetspeed.services.portletstats.PortletStatsService;
21 import org.apache.jetspeed.portal.Portlet;
22
23
24 import org.apache.turbine.services.TurbineServices;
25 import org.apache.turbine.util.RunData;
26
27
28 /***
29 * <P>This is a commodity static accessor class around the
30 * <code>PortletStatsService</code></P>
31 *
32 * @see org.apache.jetspeed.services.portletstats.PortletStatsService
33 * @author <a href="mailto:morciuch@apache.org">Mark Orciuch</a>
34 * @version $Id: PortletStats.java,v 1.4 2004/02/23 04:00:57 jford Exp $
35 */
36 public class PortletStats {
37
38 /***
39 * Return code when access to portlet was successful
40 */
41 public static final String ACCESS_OK = "200";
42
43 /***
44 * Return code when access to portlet was denied by the security manager
45 */
46 public static final String ACCESS_DENIED = "401";
47
48 /***
49 * Commodity method for getting a reference to the service
50 * singleton
51 */
52 private static PortletStatsService getService()
53 {
54 return (PortletStatsService)TurbineServices
55 .getInstance()
56 .getService(PortletStatsService.SERVICE_NAME);
57 }
58
59 /***
60 * @see org.apache.jetspeed.services.portletstats.PortletStatsService#isEnabled
61 */
62 public static boolean isEnabled()
63 {
64 return getService().isEnabled();
65 }
66
67 /***
68 * @see org.apache.jetspeed.services.portletstats.PortletStatsService#setEnabled
69 */
70 public static boolean setEnabled(boolean state)
71 {
72 return getService().setEnabled(state);
73 }
74
75 /***
76 * @see org.apache.jetspeed.services.portletstats.PortletStatsService#logAccess
77 */
78 public static void logAccess(RunData data, Portlet portlet, String statusCode)
79 {
80 getService().logAccess(data, portlet, statusCode);
81 }
82
83 /***
84 * @see org.apache.jetspeed.services.portletstats.PortletStatsService#logAccess
85 */
86 public static void logAccess(RunData data, Portlet portlet, String statusCode, long time)
87 {
88 getService().logAccess(data, portlet, statusCode, time);
89 }
90 }