KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > services > PortletStats


1 /*
2  * Copyright 2000-2001,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.jetspeed.services;
18
19 // jetspeed stuff
20
import org.apache.jetspeed.services.portletstats.PortletStatsService;
21 import org.apache.jetspeed.portal.Portlet;
22
23 // turbine stuff
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 JavaDoc ACCESS_OK = "200";
42
43     /**
44      * Return code when access to portlet was denied by the security manager
45      */

46     public static final String JavaDoc 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 JavaDoc 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 JavaDoc statusCode, long time)
87     {
88         getService().logAccess(data, portlet, statusCode, time);
89     }
90 }
91
Popular Tags